Skip to content

Instantly share code, notes, and snippets.

@felangel
Created April 27, 2019 18:03
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 felangel/cff0fff8f4b0f9d6e00d9552aeca30f5 to your computer and use it in GitHub Desktop.
Save felangel/cff0fff8f4b0f9d6e00d9552aeca30f5 to your computer and use it in GitHub Desktop.
[flutter_firebase_login] App (2)
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