Comments (9)
Okay so. This is harder than I've thought.
This won't be done today. I'll continue tomorrow.
from momentum.
Migrated to null safety now!
Can be used from momentum's dev
latest commit:
dependencies:
# other deps here
momentum:
git:
url: https://github.com/xamantra/momentum.git
ref: 5ed04cba9e859ba3802ed02a7dc24b1f84c4de27
# other deps here
There are still some important things that need to be updated before publishing to pub.dev. Like updating readme to have null safe code, the entire docs website, and the comment docs.
from momentum.
Yes. I plan to upgrade all my packages to null-safety.
Yesterday, I upgraded my relative_scale package to null-safety.
I think for momentum
it might take longer though.
from momentum.
Ok so. I'm now currently migrating this to null-safety.
I decided to do it by hand because the dart migrate
command produced a lot of errors after and when I tried to fix them all, a lot of unit tests failed.
from momentum.
All unit tests need to pass without any edits in the test codes.
from momentum.
Null safety is now available on pub.dev
dependencies:
momentum: ^2.0.0
from momentum.
@xamantra not sure if it's me trying to use it for desktop (windows) or if it's momentum itself, but I'm getting this error
error
======== Exception caught by widgets library =======================================================
The following _CastError was thrown building FutureBuilder<bool>(dirty, state: _FutureBuilderState<bool>#330a6):
Null check operator used on a null value
The relevant error-causing widget was:
Momentum file:///Z:/Programming/Flutter/tfx/lib/main.dart:7:10
When the exception was thrown, this was the stack:
#0 _MomentumRootState.build.<anonymous closure> (package:momentum/src/momentum_base.dart:1286:32)
#1 _FutureBuilderState.build (package:flutter/src/widgets/async.dart:773:55)
#2 StatefulElement.build (package:flutter/src/widgets/framework.dart:4612:27)
#3 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4495:15)
#4 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4667:11)
code
import 'package:flutter/material.dart';
import 'package:momentum/momentum.dart';
import 'package:tfx/screens/index_screen.dart';
void main() {
// runApp(MyApp());
runApp(Momentum(
disabledPersistentState: true,
controllers: [],
services: [
MomentumRouter([
IndexScreen(),
])
],
));
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'TFX',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: IndexScreen(),
);
}
}
import 'package:flutter/material.dart';
class IndexScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("TFX"),
),
body: Container(
child: Center(
child: Text("Body"),
),
),
);
}
}
It's been a while since I played with momentum, not sure if every screen needs to be a momentum state or not
from momentum.
should be like this:
void main() {
// runApp(MyApp());
runApp(Momentum(
child: MyApp(),
disabledPersistentState: true,
controllers: [],
from momentum.
Oh I'm an idiot, I now know what happened.
So before I was using 1.3.x and was trying to figure out why it was derping out. I think I was commenting stuff out to try finding the bug (problem was null safety) then noticed 2.0 was out. And forgot to uncomment that back 😂
from momentum.
Related Issues (20)
- Error on new Flutter HOT 12
- Desktop support - Feature HOT 3
- Named Routing HOT 1
- Is this package production ready? HOT 4
- Is it possible to persist data on one single model alone?
- Controller can not call bootstrap & bootstrap async after reset HOT 2
- Configure Router persistence HOT 4
- More on Time Travel (undo/redo) HOT 10
- New Storage Example HOT 2
- Error: The method 'inheritFromWidgetOfExactType' HOT 3
- Is it possible to use Flutter hooks with this? HOT 1
- Website has certificate error HOT 2
- Flutter Web - [Momentum]: Failed to initialize your app. HOT 4
- Does calling init() do anything? HOT 1
- How access to model outside controller and view? HOT 1
- Improve code doc
- Routing interceptor - initial page based on authorization logic HOT 2
- Model.fromJson is not a valid override of MomentumModel.fromJson HOT 2
- MomentumRouter.resetWithContext and Momentum.restart not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from momentum.