Skip to content

Instantly share code, notes, and snippets.

@raveesh-me
Last active September 20, 2018 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raveesh-me/a191ead0609810b04216af186b4075a1 to your computer and use it in GitHub Desktop.
Save raveesh-me/a191ead0609810b04216af186b4075a1 to your computer and use it in GitHub Desktop.
UserInfoManager InheritedWidget
class UserInfoManager extends InheritedWidget {
final Key key;
final ManagedUserInfo managedUserInfo;
final Widget child;
final Function() refreshManagedUserInfo;
UserInfoManager(
{@required this.managedUserInfo,
@required this.child,
@required this.setManagedUserInfo,
this.key})
: super(key: key, child: child);
@override
bool updateShouldNotify(UserInfoManager oldWidget) {
return oldWidget.managedUserInfo.appLoginState ==
managedUserInfo.appLoginState;
}
static UserInfoManager of(BuildContext context) =>
context.inheritFromWidgetOfExactType(UserInfoManager);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment