Last active
April 25, 2020 10:55
-
-
Save itskgore/cd5c81d74d3be38d33973d1a58e1eee3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
return MultiProvider( | |
providers: [ | |
ChangeNotifierProvider.value(value: Auth()), | |
], | |
child: MaterialApp( | |
title: 'Flutter Demo', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: Consumer<Auth>( | |
builder: (ctx, auth, _) => FutureBuilder( | |
future: auth.isLogin, | |
builder: (ctx, snap) => | |
snap.connectionState == ConnectionState.waiting | |
? CircularProgressIndicator() | |
: snap.data ? HomeScreen() : LoginScreen()), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment