Skip to content

Instantly share code, notes, and snippets.

@itskgore
Last active April 25, 2020 10:55
Show Gist options
  • Save itskgore/cd5c81d74d3be38d33973d1a58e1eee3 to your computer and use it in GitHub Desktop.
Save itskgore/cd5c81d74d3be38d33973d1a58e1eee3 to your computer and use it in GitHub Desktop.
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