Created
April 27, 2019 18:03
-
-
Save felangel/cff0fff8f4b0f9d6e00d9552aeca30f5 to your computer and use it in GitHub Desktop.
[flutter_firebase_login] App (2)
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
import 'package:flutter/material.dart'; | |
import 'package:bloc/bloc.dart'; | |
import 'package:flutter_bloc/flutter_bloc.dart'; | |
import 'package:flutter_firebase_login/authentication_bloc/bloc.dart'; | |
import 'package:flutter_firebase_login/user_repository.dart'; | |
main() { | |
runApp(App()); | |
} | |
class App extends StatefulWidget { | |
State<App> createState() => _AppState(); | |
} | |
class _AppState extends State<App> { | |
final UserRepository _userRepository = UserRepository(); | |
AuthenticationBloc _authenticationBloc; | |
@override | |
void initState() { | |
super.initState(); | |
_authenticationBloc = AuthenticationBloc(userRepository: _userRepository); | |
_authenticationBloc.dispatch(AppStarted()); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return BlocProvider( | |
bloc: _authenticationBloc, | |
child: MaterialApp( | |
home: BlocBuilder( | |
bloc: _authenticationBloc, | |
builder: (BuildContext context, AuthenticationState state) { | |
return Container(); | |
}, | |
), | |
), | |
); | |
} | |
@override | |
void dispose() { | |
_authenticationBloc.dispose(); | |
super.dispose(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment