Created
September 15, 2019 19:27
-
-
Save dsrenesanse/ca683c3eaa2738ad4952a5727675a7db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BlocInjector extends InheritedWidget { | |
BlocInjector({ | |
Key key, | |
@required Widget child, | |
@required this.bloc, | |
}) : super(key: key, child: child); | |
final Bloc bloc; | |
static BlocInjector of(BuildContext context) => | |
context.inheritFromWidgetOfExactType(BlocInjector); | |
@override | |
bool updateShouldNotify(BlocInjector oldWidget) => oldWidget.bloc != bloc; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment