shelf_modular 2.0.0-dev.1
shelf_modular: ^2.0.0-dev.1 copied to clipboard
Smart project structure with dependency injection and route management
2.0.0 - 2022-05-25 #
-
[BREAK CHANGE]: Update to new Dart 2.17. Preview version will no longer be supported.
-
[BREAK CHANGE]: New auto-dispose configuration. Previously Modular had automatic closing or destruction calls for objects of type
ChangeNotifier/ValueNotifier,Streamand Triple`sStores. Starting with version 5.0, Modular will provide theBind.onDisposeproperty 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 implementDisposableonly. 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.
-
[BREAK CHANGE]
Bind.exportworks only after imported. -
feat: Added new Middleware system:
class AuthGuard extends ModularMiddleware {
@override
Handler call(Handler handler, ModularRoute route) {
return (request) {
final accessToken = request.headers['Authorization']?.split(' ').last;
if (accessToken == null || accessToken.isEmpty || accessToken != '1234') {
return Response.forbidden(jsonEncode({'error': 'Not authorized'}));
}
return handler(request);
};
}
}
1.0.2 - 2022-04-05 #
- Update modular_core
1.0.1 - 2021-12-31 #
- Fixed "bind replaced" bug
1.0.0 - 2021-10-20 #
- initial release.
- New doc!