-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor flutter_bloc to use provider #385
Conversation
46cba02
to
b9089cf
Compare
Codecov Report
@@ Coverage Diff @@
## master #385 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 12 11 -1
Lines 189 174 -15
=====================================
- Hits 189 174 -15
Continue to review full report at Codecov.
|
@rrousselGit what do you think? |
This specific implementation of BlocProvider could be made by subclassing Provider: class BlocProvider<T extends Bloc> extends Provider<T> {
BlocProvider(
Key key,
@required ValueBuilder<T> builder,
Widget child,
): super(key: key, builder: builder, child: child, dispose: (_, bloc) => bloc.dispose());
BlocProvider.value(
Key key,
@required T value,
Widget child,
): super.value(key: key, value: value, child: child);
static T of<T extends Bloc>(BuildContext context) {
...
}
} |
It may be interesting to subclass The mixin shorthand can make it simple: mixin _NoOp {}
@Deprecated('Use MultiProvider instead')
class BlocProviderTree = MultiProvider with _NoOp;
@Deprecated('Use MultiProvider instead')
class ImmutableProviderTree = MultiProvider with _NoOp; |
Since the api would already be different ( I'm more concerned about what we're going to do about |
Thanks for the suggestion 👍 Made the change so now the main thing left to work out is how to replace |
94b1a13
to
fb7b5ab
Compare
I don't get why removing |
@axellebot I can definitely make that change. It just didn’t seem like BlocListenerTree was being used when I went around asking developers. |
0156c83
to
fb4698b
Compare
Status
READY
Breaking Changes
YES
Description
Addresses #354
BlocProvider
BlocProvider
to extendProvider
BlocProviderTree
toMultiBlocProvider
ImmutableProvider -> RepositoryProvider
ImmutableProvider
to extendProvider
ImmutableProvider
toRepositoryProvider
ImmutableProviderTree
toMultiRepositoryProvider
BlocListener
BlocListenerTree
toMultiBlocListener
Overall