Releases: Flutterando/modular
v5.0.3
v5.0.2
- Fix: Parse params in RouteOutlet
v5.0.1
- Support Cubit
v5.0.0
- Support Flutter 3.0.0
- [BREAK CHANGE]: Removed
MaterialApp.modular()
andCupertino().modular()
.
Use instead:return MaterialApp.router( routeInformationParser: Modular.routeInformationParser, routerDelegate: Modular.routerDelegate, );
This modification aims to keep Modular support independent of WidgetApp
updates, and can be used in other bootstraps such as FluentApp [fluent_ui]
.
- [BREAK CHANGE]: New auto-dispose configuration.
Previously Modular had automatic closing or destruction calls for objects of typeChangeNotifier/ValueNotifier
,Stream
and Triple`sStores
.
Starting with version 5.0, Modular will provide theBind.onDispose
property for calls to destroy, close or dispose methods FOR EACH BIND. This will make the dispose settings more straightforward and less universal. Therefore, Modular will manage the destruction of Binds that implementDisposable
only. This is the new configuration:
@override
final List<Bind> binds = [
Bind.singleton((i) => MyBloc(), onDispose: (bloc) => bloc.close()),
];
The Bind.onDispose
CANNOT be used in Bind type factory.
You can choose to use Bind.onDispose
or implement the Disposable
class.
- Added
Bind.selector
. Generates a reactivity (Listenable/Stream) to be listened to whencontext.watch()
is called.
@override
final List<Bind> binds = [
//notifier return stream or listenable to use context.watch()
Bind.singleton((i) => MyBloc(), onDispose: (bloc) => bloc.close(), selector: (bloc) => bloc.stream),
];
- [BREAK CHANGE]: As already described above, the reactivities worked externally to Modular, providing a
longer life to the project. For this reason, BLoC or Triple users should use specialBind's
in order to use thecontext.watch()
and auto dispose functionality. They are:BlocBind()
andTripleBind()
, which are available through external packages.
modular_bloc_bind -> BlocBind
modular_triple_bind -> TripleBind
Example:
@override
final List<Bind> binds = [
BlocBind.singleton((i) => MyBloc()),
];
-
[BREAK CHANGE]
Bind.export
works only after imported. -
@deprecated
ModularState
.
A few months of research showed us that ModularState caused unnecessary coupling with the view and made it difficult for those who used it to understand. For this reason, we decided to deprecate it to ensure code congruence for all professionals who use Modular. -
Removed
triple
dependency. -
Simplify docs.
-
Added
Modular.setArguments
.
Modular.setArguments('cody1024d');
// get
Modular.args.data; // -> cody1024d
//or
Bind((i) => MyClass(i.args.data));
Issues
v4.5.0
- @deprecated:
.modular()
extension.
Use instead:return MaterialApp.router( routeInformationParser: Modular.routeInformationParser, routerDelegate: Modular.routerDelegate, );
- Added
Modular.setInitialRoute
. - Added
Modular.setObservers
. - Added
Modular.setNavigatorKey
.
v4.3.0
- Added BuildContext extension [context.read()] and [context.watch()];
- The [context.watch()] listen changes of [Listanable], [Stream] and [Store] by Triple;
class Body extends StatelessWidget {
Widget build(BuildContext context){
final notifier = context.watch<ValueNotifier>();
return Text('${notifier.value}')
}
}
- Use
select
in.watch()
to select the reactive property:
class Body extends StatelessWidget {
Widget build(BuildContext context){
final bloc = context.watch<CounterBloc>((bloc) => bloc.stream);
return Text('${bloc.state}')
}
}
Also, use Store Selectors
in conjunction with .watch
:
class OnlyErrorWidget extends StatelessWidget {
Widget build(BuildContext context){
// changes with store.setError();
final store = context.watch<MyTripleStore>((store) => store.selectError);
return Text('${store.error}')
}
}
See more details here
4.1.2
Version 4.0.1
- Fixed pushNamed.
- Fixed bug that allowed access to parameters and arguments in other modules.
- Fixed transitions bug.
Release 4.0.0+7
New documentation is here! https://modular.flutterando.com.br.
Modular design now uses Layered Architecture (Clean Architecture) with 100% code coverage.
Up to 30% improvement in obtaining routes.
BREAK CHANGE: RouteGuard([redirectTo]) -> RouteGuard({String? redirectTo}).
BREAK CHANGE: flutter_modular_test will be discontinued. Use modular_test instead.
FIX #516
Fixes on RouteOutlet navigations
Fixes on RouteOutlet navigations