Share
Flutter at scale: 2020 Edition
Flutter has been out of beta for more than a year. It is an amazing framework UI that lets you run your code pretty much anywhere. There's a lot of expectations around it, incredible apps running at 60fps, but... is it ready to be adopted at scale?
At BMW, we faced that question a while ago, and the answer was YES! We tried it, we loved it, and we collected all the necessary information to prove that Flutter was the right choice for us. In this talk, let me show you our process to make Flutter our preferred tool for developing applications, and how we enable multiple teams around the world to deliver incredible experiences fast and safely.
Jorge Coca
Annual Pro sale · Save $30
Have presentations of your own?
Share with private links, password protection, and more control over your work.
Transcript
134 slides
-
Flutter at scale 1 — Flutter Europe 2020 / Jorge
Coca @ Very Good Ventures -
2 — Flutter Europe 2020 / Jorge Coca @ Very
Good Ventures -
Flutter at scale 2020 edition 3 — Flutter Europe 2020
/ Jorge Coca @ Very Good Ventures -
In 2019... !" 4 — Flutter Europe 2020 / Jorge
Coca @ Very Good Ventures -
In 2020! ! 5 — Flutter Europe 2020 / Jorge
Coca @ Very Good Ventures -
!"# 6 — Flutter Europe 2020 / Jorge Coca @
Very Good Ventures -
!"# !☁ 7 — Flutter Europe 2020 / Jorge Coca
@ Very Good Ventures -
What do you mean by Flutter at scale? 8 —
Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
What do you mean by **** at scale? 9 —
Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Complex problems, easy solutions 10 — Flutter Europe 2020 /
Jorge Coca @ Very Good Ventures -
What is a problem? 11 — Flutter Europe 2020 /
Jorge Coca @ Very Good Ventures -
What is a problem? → A question raised for inquiry,
consideration, or solution 11 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
What is a problem? → A question raised for inquiry,
consideration, or solution → A proposition in mathematics or physics stating something to be done 11 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
What is a problem? → A question raised for inquiry,
consideration, or solution → A proposition in mathematics or physics stating something to be done → A source of perplexity, distress, or vexation 11 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
In programming, we solve problems with APIs, and positive and
efficient communication 12 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
What problems are we solving in UI development? 13 —
Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
What problems are we solving in UI development? → How
to simplify and/or improve our UI development? 13 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
What problems are we solving in UI development? → How
to simplify and/or improve our UI development? → How to be more productive? 13 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
What problems are we solving in UI development? → How
to simplify and/or improve our UI development? → How to be more productive? → How can we be more cost efficient? 13 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
What problems are we solving in UI development? → How
to simplify and/or improve our UI development? → How to be more productive? → How can we be more cost efficient? → How can we guarantee that our app is robust? 13 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
What problems are we solving in UI development? → How
to simplify and/or improve our UI development? → How to be more productive? → How can we be more cost efficient? → How can we guarantee that our app is robust? 14 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
We already have an answer... 15 — Flutter Europe 2020
/ Jorge Coca @ Very Good Ventures -
Dart and Flutter are... 16 — Flutter Europe 2020 /
Jorge Coca @ Very Good Ventures -
Dart and Flutter are... → Simple, UI-oriented -> widgets 16
— Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Dart and Flutter are... → Simple, UI-oriented -> widgets →
Productive -> hot reload 16 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Dart and Flutter are... → Simple, UI-oriented -> widgets →
Productive -> hot reload → Cost efficient -> single codebase 16 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Dart and Flutter are... → Simple, UI-oriented -> widgets →
Productive -> hot reload → Cost efficient -> single codebase → Robustness -> unit, widget, and driver tests 16 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Simple Productive Cost efficient Robust 17 — Flutter Europe 2020
/ Jorge Coca @ Very Good Ventures -
Whatever we do that breaks any of those 4 pillars
will not let us scale ! 18 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Whatever we do that potentiate any of those 4 pillars
will skyrocket your development! ! 19 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
So... what can we do? 20 — Flutter Europe 2020
/ Jorge Coca @ Very Good Ventures -
Flutter is a UI toolkit 21 — Flutter Europe 2020
/ Jorge Coca @ Very Good Ventures -
UI = f (state) 22 — Flutter Europe 2020 /
Jorge Coca @ Very Good Ventures -
How we manage state has a big impact on our
app 23 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Try it by yourself... 24 — Flutter Europe 2020 /
Jorge Coca @ Very Good Ventures -
Try it by yourself... → setState 24 — Flutter Europe
2020 / Jorge Coca @ Very Good Ventures -
Try it by yourself... → setState → Redux 24 —
Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Try it by yourself... → setState → Redux → Mobx
24 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Try it by yourself... → setState → Redux → Mobx
→ ScopedModel 24 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Try it by yourself... → setState → Redux → Mobx
→ ScopedModel → Provider 24 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Try it by yourself... → setState → Redux → Mobx
→ ScopedModel → Provider → ... others? 24 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
! No one likes developers with their own methods 25
— Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Please use a tool/ system/pattern that is documented, so everyone
can learn about it 26 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
..but, if you ask me... 27 — Flutter Europe 2020
/ Jorge Coca @ Very Good Ventures -
@felangelov - bloclibrary.dev 28 — Flutter Europe 2020 / Jorge
Coca @ Very Good Ventures -
Say hi! 29 — Flutter Europe 2020 / Jorge Coca
@ Very Good Ventures -
Why Bloc? It's simple, predictable, productive, and robust! 30 —
Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class CounterBloc extends Bloc<CounterEvent, int> { @override int get initialState
=> 0; @override Stream<int> mapEventToState(CounterEvent event) async* { switch (event) { case CounterEvent.decrement: yield state - 1; break; case CounterEvent.increment: yield state + 1; break; } } } 31 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class CounterBloc extends Bloc<CounterEvent, int> { @override int get initialState
=> 0; @override Stream<int> mapEventToState(CounterEvent event) async* { switch (event) { case CounterEvent.decrement: yield state - 1; break; case CounterEvent.increment: yield state + 1; break; } } } 31 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class CounterBloc extends Bloc<CounterEvent, int> { @override int get initialState
=> 0; @override Stream<int> mapEventToState(CounterEvent event) async* { switch (event) { case CounterEvent.decrement: yield state - 1; break; case CounterEvent.increment: yield state + 1; break; } } } 31 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class CounterBloc extends Bloc<CounterEvent, int> { @override int get initialState
=> 0; @override Stream<int> mapEventToState(CounterEvent event) async* { switch (event) { case CounterEvent.decrement: yield state - 1; break; case CounterEvent.increment: yield state + 1; break; } } } 31 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class CounterBloc extends Bloc<CounterEvent, int> { @override int get initialState
=> 0; @override Stream<int> mapEventToState(CounterEvent event) async* { switch (event) { case CounterEvent.decrement: yield state - 1; break; case CounterEvent.increment: yield state + 1; break; } } } 31 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class CounterPage extends StatelessWidget { @override Widget build(BuildContext context) {
final CounterBloc counterBloc = BlocProvider.of<CounterBloc>(context); return Scaffold( appBar: AppBar(title: Text('Counter')), body: BlocBuilder<CounterBloc, int>( builder: (context, count) { return Text('$count'); }, ), floatingActionButton: Column( children: [ FloatingActionButton( child: Icon(Icons.add), onPressed: () { counterBloc.add(CounterEvent.increment); }, ), FloatingActionButton( child: Icon(Icons.remove), onPressed: () { counterBloc.add(CounterEvent.decrement); }, ), ], ), ); } } 32 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class CounterPage extends StatelessWidget { @override Widget build(BuildContext context) {
final CounterBloc counterBloc = BlocProvider.of<CounterBloc>(context); return Scaffold( appBar: AppBar(title: Text('Counter')), body: BlocBuilder<CounterBloc, int>( builder: (context, count) { return Text('$count'); }, ), floatingActionButton: Column( children: [ FloatingActionButton( child: Icon(Icons.add), onPressed: () { counterBloc.add(CounterEvent.increment); }, ), FloatingActionButton( child: Icon(Icons.remove), onPressed: () { counterBloc.add(CounterEvent.decrement); }, ), ], ), ); } } 32 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class CounterPage extends StatelessWidget { @override Widget build(BuildContext context) {
final CounterBloc counterBloc = BlocProvider.of<CounterBloc>(context); return Scaffold( appBar: AppBar(title: Text('Counter')), body: BlocBuilder<CounterBloc, int>( builder: (context, count) { return Text('$count'); }, ), floatingActionButton: Column( children: [ FloatingActionButton( child: Icon(Icons.add), onPressed: () { counterBloc.add(CounterEvent.increment); }, ), FloatingActionButton( child: Icon(Icons.remove), onPressed: () { counterBloc.add(CounterEvent.decrement); }, ), ], ), ); } } 32 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class CounterPage extends StatelessWidget { @override Widget build(BuildContext context) {
final CounterBloc counterBloc = BlocProvider.of<CounterBloc>(context); return Scaffold( appBar: AppBar(title: Text('Counter')), body: BlocBuilder<CounterBloc, int>( builder: (context, count) { return Text('$count'); }, ), floatingActionButton: Column( children: [ FloatingActionButton( child: Icon(Icons.add), onPressed: () { counterBloc.add(CounterEvent.increment); }, ), FloatingActionButton( child: Icon(Icons.remove), onPressed: () { counterBloc.add(CounterEvent.decrement); }, ), ], ), ); } } 32 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class CounterPage extends StatelessWidget { @override Widget build(BuildContext context) {
final CounterBloc counterBloc = BlocProvider.of<CounterBloc>(context); return Scaffold( appBar: AppBar(title: Text('Counter')), body: BlocBuilder<CounterBloc, int>( builder: (context, count) { return Text('$count'); }, ), floatingActionButton: Column( children: [ FloatingActionButton( child: Icon(Icons.add), onPressed: () { counterBloc.add(CounterEvent.increment); }, ), FloatingActionButton( child: Icon(Icons.remove), onPressed: () { counterBloc.add(CounterEvent.decrement); }, ), ], ), ); } } 32 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class WeatherBloc extends Bloc<WeatherEvent, WeatherState> { final WeatherRepository weatherRepository; WeatherBloc({@required
this.weatherRepository}); @override WeatherState get initialState => WeatherEmpty(); @override Stream<WeatherState> mapEventToState(WeatherEvent event) async* { if (event is FetchWeather) { yield WeatherLoading(); try { final Weather weather = await weatherRepository.getWeather(event.city); yield WeatherLoaded(weather: weather); } catch (_) { yield WeatherError(); } } } } 33 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class WeatherBloc extends Bloc<WeatherEvent, WeatherState> { final WeatherRepository weatherRepository; WeatherBloc({@required
this.weatherRepository}); @override WeatherState get initialState => WeatherEmpty(); @override Stream<WeatherState> mapEventToState(WeatherEvent event) async* { if (event is FetchWeather) { yield WeatherLoading(); try { final Weather weather = await weatherRepository.getWeather(event.city); yield WeatherLoaded(weather: weather); } catch (_) { yield WeatherError(); } } } } 33 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class WeatherBloc extends Bloc<WeatherEvent, WeatherState> { final WeatherRepository weatherRepository; WeatherBloc({@required
this.weatherRepository}); @override WeatherState get initialState => WeatherEmpty(); @override Stream<WeatherState> mapEventToState(WeatherEvent event) async* { if (event is FetchWeather) { yield WeatherLoading(); try { final Weather weather = await weatherRepository.getWeather(event.city); yield WeatherLoaded(weather: weather); } catch (_) { yield WeatherError(); } } } } 33 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
class WeatherBloc extends Bloc<WeatherEvent, WeatherState> { final WeatherRepository weatherRepository; WeatherBloc({@required
this.weatherRepository}); @override WeatherState get initialState => WeatherEmpty(); @override Stream<WeatherState> mapEventToState(WeatherEvent event) async* { if (event is FetchWeather) { yield WeatherLoading(); try { final Weather weather = await weatherRepository.getWeather(event.city); yield WeatherLoaded(weather: weather); } catch (_) { yield WeatherError(); } } } } 33 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Productive: IDE generators 34 — Flutter Europe 2020 / Jorge
Coca @ Very Good Ventures -
... and it is also robust! blocTest( 'emits [0, 1]
when CounterEvent.increment is added', build: () => counterBloc, act: (bloc) => bloc.add(CounterEvent.increment), expect: [0, 1], ); blocTest( 'emits [0, -1] when CounterEvent.decrement is added', build: () => counterBloc, act: (bloc) => bloc.add(CounterEvent.decrement), expect: [0, -1], ); 35 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
... and it is also robust! blocTest( 'emits [0, 1]
when CounterEvent.increment is added', build: () => counterBloc, act: (bloc) => bloc.add(CounterEvent.increment), expect: [0, 1], ); blocTest( 'emits [0, -1] when CounterEvent.decrement is added', build: () => counterBloc, act: (bloc) => bloc.add(CounterEvent.decrement), expect: [0, -1], ); 35 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
... and it is also robust! blocTest( 'emits [0, 1]
when CounterEvent.increment is added', build: () => counterBloc, act: (bloc) => bloc.add(CounterEvent.increment), expect: [0, 1], ); blocTest( 'emits [0, -1] when CounterEvent.decrement is added', build: () => counterBloc, act: (bloc) => bloc.add(CounterEvent.decrement), expect: [0, -1], ); 35 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
... even with async code! blocTest( 'emits [empty, loading, error]
when fetching weather and network fails', build: () { when(weatherRepository.getWeather(any)).thenThrow(Exception('ooops')); return weatherBloc; }, act: (bloc) => bloc.add(FetchWeather('Warsaw')), expect: [WeatherEmpty(), WeatherLoading(), WeatherError()], ); 36 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
... even with async code! blocTest( 'emits [empty, loading, error]
when fetching weather and network fails', build: () { when(weatherRepository.getWeather(any)).thenThrow(Exception('ooops')); return weatherBloc; }, act: (bloc) => bloc.add(FetchWeather('Warsaw')), expect: [WeatherEmpty(), WeatherLoading(), WeatherError()], ); 36 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
... even with async code! blocTest( 'emits [empty, loading, error]
when fetching weather and network fails', build: () { when(weatherRepository.getWeather(any)).thenThrow(Exception('ooops')); return weatherBloc; }, act: (bloc) => bloc.add(FetchWeather('Warsaw')), expect: [WeatherEmpty(), WeatherLoading(), WeatherError()], ); 36 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
... even with async code! blocTest( 'emits [empty, loading, error]
when fetching weather and network fails', build: () { when(weatherRepository.getWeather(any)).thenThrow(Exception('ooops')); return weatherBloc; }, act: (bloc) => bloc.add(FetchWeather('Warsaw')), expect: [WeatherEmpty(), WeatherLoading(), WeatherError()], ); 36 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
With bloc, so far... 37 — Flutter Europe 2020 /
Jorge Coca @ Very Good Ventures -
With bloc, so far... → Simple 37 — Flutter Europe
2020 / Jorge Coca @ Very Good Ventures -
With bloc, so far... → Simple → Productive 37 —
Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
With bloc, so far... → Simple → Productive → Cost
efficient 37 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
With bloc, so far... → Simple → Productive → Cost
efficient → Robust 37 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Wouldn't be awesome to have an system that is capable
of telling us what's going on at any given point in time? !"# 38 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Bloc as a BlocDelegate! class SimpleBlocDelegate extends BlocDelegate { @override
void onEvent(Bloc bloc, Object event) { super.onEvent(bloc, event); print(event); } @override void onTransition(Bloc bloc, Transition transition) { super.onTransition(bloc, transition); print(transition); } @override void onError(Bloc bloc, Object error, StackTrace stacktrace) { super.onError(bloc, error, stacktrace); print('$error, $stacktrace'); } } 39 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Bloc as a BlocDelegate! class SimpleBlocDelegate extends BlocDelegate { @override
void onEvent(Bloc bloc, Object event) { super.onEvent(bloc, event); print(event); } @override void onTransition(Bloc bloc, Transition transition) { super.onTransition(bloc, transition); print(transition); } @override void onError(Bloc bloc, Object error, StackTrace stacktrace) { super.onError(bloc, error, stacktrace); print('$error, $stacktrace'); } } 39 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Bloc as a BlocDelegate! class SimpleBlocDelegate extends BlocDelegate { @override
void onEvent(Bloc bloc, Object event) { super.onEvent(bloc, event); print(event); } @override void onTransition(Bloc bloc, Transition transition) { super.onTransition(bloc, transition); print(transition); } @override void onError(Bloc bloc, Object error, StackTrace stacktrace) { super.onError(bloc, error, stacktrace); print('$error, $stacktrace'); } } 39 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Bloc as a BlocDelegate! class SimpleBlocDelegate extends BlocDelegate { @override
void onEvent(Bloc bloc, Object event) { super.onEvent(bloc, event); print(event); } @override void onTransition(Bloc bloc, Transition transition) { super.onTransition(bloc, transition); print(transition); } @override void onError(Bloc bloc, Object error, StackTrace stacktrace) { super.onError(bloc, error, stacktrace); print('$error, $stacktrace'); } } 39 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
All this for free! LoginBloc: { currentState: LoginInitial, event: LoginFormChanged,
nextState: LoginFormValidationFailure } LoginBloc: { currentState: LoginFormValidationFailure, event: LoginFormChanged, nextState: LoginFormValidationSuccess } LoginBloc: { currentState: LoginFormValidationSuccess, event: LoginSubmitted, nextState: LoginInProgress } LoginBloc: { currentState: LoginInProgress, event: LoginSubmitted, nextState: LoginSuccess } AuthenticationBloc: { currentState: AuthenticationFailure, event: LoggedIn { user: this_is_a_fake_user }, nextState: AuthenticationSuccess } HomeBloc: { currentState: HomeState.storesTab, event: TabSelected { index: 1 }, nextState: HomeState.tasksTab } HomeBloc: { currentState: HomeState.tasksTab, event: TabSelected { index: 2 }, nextState: HomeState.profileTab } 40 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
All this for free! LoginBloc: { currentState: LoginInitial, event: LoginFormChanged,
nextState: LoginFormValidationFailure } LoginBloc: { currentState: LoginFormValidationFailure, event: LoginFormChanged, nextState: LoginFormValidationSuccess } LoginBloc: { currentState: LoginFormValidationSuccess, event: LoginSubmitted, nextState: LoginInProgress } LoginBloc: { currentState: LoginInProgress, event: LoginSubmitted, nextState: LoginSuccess } AuthenticationBloc: { currentState: AuthenticationFailure, event: LoggedIn { user: this_is_a_fake_user }, nextState: AuthenticationSuccess } HomeBloc: { currentState: HomeState.storesTab, event: TabSelected { index: 1 }, nextState: HomeState.tasksTab } HomeBloc: { currentState: HomeState.tasksTab, event: TabSelected { index: 2 }, nextState: HomeState.profileTab } 40 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
All this for free! LoginBloc: { currentState: LoginInitial, event: LoginFormChanged,
nextState: LoginFormValidationFailure } LoginBloc: { currentState: LoginFormValidationFailure, event: LoginFormChanged, nextState: LoginFormValidationSuccess } LoginBloc: { currentState: LoginFormValidationSuccess, event: LoginSubmitted, nextState: LoginInProgress } LoginBloc: { currentState: LoginInProgress, event: LoginSubmitted, nextState: LoginSuccess } AuthenticationBloc: { currentState: AuthenticationFailure, event: LoggedIn { user: this_is_a_fake_user }, nextState: AuthenticationSuccess } HomeBloc: { currentState: HomeState.storesTab, event: TabSelected { index: 1 }, nextState: HomeState.tasksTab } HomeBloc: { currentState: HomeState.tasksTab, event: TabSelected { index: 2 }, nextState: HomeState.profileTab } 40 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
All this for free! LoginBloc: { currentState: LoginInitial, event: LoginFormChanged,
nextState: LoginFormValidationFailure } LoginBloc: { currentState: LoginFormValidationFailure, event: LoginFormChanged, nextState: LoginFormValidationSuccess } LoginBloc: { currentState: LoginFormValidationSuccess, event: LoginSubmitted, nextState: LoginInProgress } LoginBloc: { currentState: LoginInProgress, event: LoginSubmitted, nextState: LoginSuccess } AuthenticationBloc: { currentState: AuthenticationFailure, event: LoggedIn { user: this_is_a_fake_user }, nextState: AuthenticationSuccess } HomeBloc: { currentState: HomeState.storesTab, event: TabSelected { index: 1 }, nextState: HomeState.tasksTab } HomeBloc: { currentState: HomeState.tasksTab, event: TabSelected { index: 2 }, nextState: HomeState.profileTab } 40 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
All this for free! LoginBloc: { currentState: LoginInitial, event: LoginFormChanged,
nextState: LoginFormValidationFailure } LoginBloc: { currentState: LoginFormValidationFailure, event: LoginFormChanged, nextState: LoginFormValidationSuccess } LoginBloc: { currentState: LoginFormValidationSuccess, event: LoginSubmitted, nextState: LoginInProgress } LoginBloc: { currentState: LoginInProgress, event: LoginSubmitted, nextState: LoginSuccess } AuthenticationBloc: { currentState: AuthenticationFailure, event: LoggedIn { user: this_is_a_fake_user }, nextState: AuthenticationSuccess } HomeBloc: { currentState: HomeState.storesTab, event: TabSelected { index: 1 }, nextState: HomeState.tasksTab } HomeBloc: { currentState: HomeState.tasksTab, event: TabSelected { index: 2 }, nextState: HomeState.profileTab } 40 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
All this for free! LoginBloc: { currentState: LoginInitial, event: LoginFormChanged,
nextState: LoginFormValidationFailure } LoginBloc: { currentState: LoginFormValidationFailure, event: LoginFormChanged, nextState: LoginFormValidationSuccess } LoginBloc: { currentState: LoginFormValidationSuccess, event: LoginSubmitted, nextState: LoginInProgress } LoginBloc: { currentState: LoginInProgress, event: LoginSubmitted, nextState: LoginSuccess } AuthenticationBloc: { currentState: AuthenticationFailure, event: LoggedIn { user: this_is_a_fake_user }, nextState: AuthenticationSuccess } HomeBloc: { currentState: HomeState.storesTab, event: TabSelected { index: 1 }, nextState: HomeState.tasksTab } HomeBloc: { currentState: HomeState.tasksTab, event: TabSelected { index: 2 }, nextState: HomeState.profileTab } 40 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
All this for free! LoginBloc: { currentState: LoginInitial, event: LoginFormChanged,
nextState: LoginFormValidationFailure } LoginBloc: { currentState: LoginFormValidationFailure, event: LoginFormChanged, nextState: LoginFormValidationSuccess } LoginBloc: { currentState: LoginFormValidationSuccess, event: LoginSubmitted, nextState: LoginInProgress } LoginBloc: { currentState: LoginInProgress, event: LoginSubmitted, nextState: LoginSuccess } AuthenticationBloc: { currentState: AuthenticationFailure, event: LoggedIn { user: this_is_a_fake_user }, nextState: AuthenticationSuccess } HomeBloc: { currentState: HomeState.storesTab, event: TabSelected { index: 1 }, nextState: HomeState.tasksTab } HomeBloc: { currentState: HomeState.tasksTab, event: TabSelected { index: 2 }, nextState: HomeState.profileTab } 40 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
All this for free! LoginBloc: { currentState: LoginInitial, event: LoginFormChanged,
nextState: LoginFormValidationFailure } LoginBloc: { currentState: LoginFormValidationFailure, event: LoginFormChanged, nextState: LoginFormValidationSuccess } LoginBloc: { currentState: LoginFormValidationSuccess, event: LoginSubmitted, nextState: LoginInProgress } LoginBloc: { currentState: LoginInProgress, event: LoginSubmitted, nextState: LoginSuccess } AuthenticationBloc: { currentState: AuthenticationFailure, event: LoggedIn { user: this_is_a_fake_user }, nextState: AuthenticationSuccess } HomeBloc: { currentState: HomeState.storesTab, event: TabSelected { index: 1 }, nextState: HomeState.tasksTab } HomeBloc: { currentState: HomeState.tasksTab, event: TabSelected { index: 2 }, nextState: HomeState.profileTab } 40 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Jorge, you won't trick me this time! Those are only
print statements! ! 41 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
lumberdash https://github.com/bmw-tech/lumberdash void main() { putLumberdashToWork(withClients: [ ColorizeLumberdash(), FirebaseLumberdash(...), ]);
logWarning('Hello Warning'); logFatal('Hello Fatal!'); logMessage('Hello Message!'); logError(Exception('Hello Error')); } 42 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
lumberdash https://github.com/bmw-tech/lumberdash void main() { putLumberdashToWork(withClients: [ ColorizeLumberdash(), FirebaseLumberdash(...), ]);
logWarning('Hello Warning'); logFatal('Hello Fatal!'); logMessage('Hello Message!'); logError(Exception('Hello Error')); } 42 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
lumberdash https://github.com/bmw-tech/lumberdash void main() { putLumberdashToWork(withClients: [ ColorizeLumberdash(), FirebaseLumberdash(...), ]);
logWarning('Hello Warning'); logFatal('Hello Fatal!'); logMessage('Hello Message!'); logError(Exception('Hello Error')); } 42 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Bloc is cost efficient import 'package:lumberdash/lumberdash.dart'; class LumberdashBlocDelegate extends BlocDelegate
{ @override void onTransition(Bloc bloc, Transition transition) { super.onTransition(bloc, transition); logMessage(transition); } @override void onError(Bloc bloc, Object error, StackTrace stacktrace) { super.onError(bloc, error, stacktrace); logError(error, stacktrace); } } 43 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
With that setup, you get analytics and debug logs without
development effort 44 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
...not bad, right? ! 45 — Flutter Europe 2020 /
Jorge Coca @ Very Good Ventures -
It looks like this... 46 — Flutter Europe 2020 /
Jorge Coca @ Very Good Ventures -
With bloc, so far... 47 — Flutter Europe 2020 /
Jorge Coca @ Very Good Ventures -
With bloc, so far... → Simple 47 — Flutter Europe
2020 / Jorge Coca @ Very Good Ventures -
With bloc, so far... → Simple → Productive 47 —
Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
With bloc, so far... → Simple → Productive → Cost
efficient 47 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
With bloc, so far... → Simple → Productive → Cost
efficient → Robust 47 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Do you think we can do more? 48 — Flutter
Europe 2020 / Jorge Coca @ Very Good Ventures -
49 — Flutter Europe 2020 / Jorge Coca @ Very
Good Ventures -
Do you think we can do more? 50 — Flutter
Europe 2020 / Jorge Coca @ Very Good Ventures -
Do you think we can do more? → Simple 50
— Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Do you think we can do more? → Simple →
Productive 50 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Do you think we can do more? → Simple →
Productive → Cost efficient 50 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Do you think we can do more? → Simple →
Productive → Cost efficient → Robust 50 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
We've only seen how to unit test our blocs... 51
— Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
How can we truly measure the performance of our app?
52 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
flutter driver ozzie https://github.com/bmw-tech/ozzie.flutter 53 — Flutter Europe 2020 /
Jorge Coca @ Very Good Ventures -
Ozzie With Ozzie, during integration tests, we can capture screenshots
of every frame we want, and we can also measure the performance of our app, breaking the build if necessary. 54 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
flutter driver tests void main() { FlutterDriver driver; setUpAll(() async
{ driver = await FlutterDriver.connect(); }); tearDownAll(() async { if (driver != null) driver.close(); }); test('initial counter is 0', () async { await driver.waitFor(find.text('0')); }); test('initial counter is 0', () async { await driver.tap(find.byType('FloatingActionButton')); await driver.waitFor(find.text('1')); }); } 55 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
flutter driver tests void main() { FlutterDriver driver; setUpAll(() async
{ driver = await FlutterDriver.connect(); }); tearDownAll(() async { if (driver != null) driver.close(); }); test('initial counter is 0', () async { await driver.waitFor(find.text('0')); }); test('initial counter is 0', () async { await driver.tap(find.byType('FloatingActionButton')); await driver.waitFor(find.text('1')); }); } 55 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
flutter driver tests void main() { FlutterDriver driver; setUpAll(() async
{ driver = await FlutterDriver.connect(); }); tearDownAll(() async { if (driver != null) driver.close(); }); test('initial counter is 0', () async { await driver.waitFor(find.text('0')); }); test('initial counter is 0', () async { await driver.tap(find.byType('FloatingActionButton')); await driver.waitFor(find.text('1')); }); } 55 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
flutter driver tests void main() { FlutterDriver driver; setUpAll(() async
{ driver = await FlutterDriver.connect(); }); tearDownAll(() async { if (driver != null) driver.close(); }); test('initial counter is 0', () async { await driver.waitFor(find.text('0')); }); test('initial counter is 0', () async { await driver.tap(find.byType('FloatingActionButton')); await driver.waitFor(find.text('1')); }); } 55 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
flutter driver tests void main() { FlutterDriver driver; setUpAll(() async
{ driver = await FlutterDriver.connect(); }); tearDownAll(() async { if (driver != null) driver.close(); }); test('initial counter is 0', () async { await driver.waitFor(find.text('0')); }); test('initial counter is 0', () async { await driver.tap(find.byType('FloatingActionButton')); await driver.waitFor(find.text('1')); }); } 55 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
How does it wotk with Ozzie? 56 — Flutter Europe
2020 / Jorge Coca @ Very Good Ventures -
void main() { FlutterDriver driver; Ozzie ozzie; setUpAll(() async {
driver = await FlutterDriver.connect(); ozzie = Ozzie.initWith(driver, groupName: 'counter'); }); tearDownAll(() async { if (driver != null) driver.close(); ozzie.generateHtmlReport(); }); test('initial counter is 0', () async { await ozzie.profilePerformance('counter0', () async { await driver.waitFor(find.text('0')); await ozzie.takeScreenshot('initial_counter_is_0'); }); }); test('initial counter is 0', () async { await ozzie.profilePerformance('counter1', () async { await driver.tap(find.byType('FloatingActionButton')); await driver.waitFor(find.text('1')); await ozzie.takeScreenshot('counter_is_1'); }); }); } 57 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
void main() { FlutterDriver driver; Ozzie ozzie; setUpAll(() async {
driver = await FlutterDriver.connect(); ozzie = Ozzie.initWith(driver, groupName: 'counter'); }); tearDownAll(() async { if (driver != null) driver.close(); ozzie.generateHtmlReport(); }); test('initial counter is 0', () async { await ozzie.profilePerformance('counter0', () async { await driver.waitFor(find.text('0')); await ozzie.takeScreenshot('initial_counter_is_0'); }); }); test('initial counter is 0', () async { await ozzie.profilePerformance('counter1', () async { await driver.tap(find.byType('FloatingActionButton')); await driver.waitFor(find.text('1')); await ozzie.takeScreenshot('counter_is_1'); }); }); } 57 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
void main() { FlutterDriver driver; Ozzie ozzie; setUpAll(() async {
driver = await FlutterDriver.connect(); ozzie = Ozzie.initWith(driver, groupName: 'counter'); }); tearDownAll(() async { if (driver != null) driver.close(); ozzie.generateHtmlReport(); }); test('initial counter is 0', () async { await ozzie.profilePerformance('counter0', () async { await driver.waitFor(find.text('0')); await ozzie.takeScreenshot('initial_counter_is_0'); }); }); test('initial counter is 0', () async { await ozzie.profilePerformance('counter1', () async { await driver.tap(find.byType('FloatingActionButton')); await driver.waitFor(find.text('1')); await ozzie.takeScreenshot('counter_is_1'); }); }); } 57 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
void main() { FlutterDriver driver; Ozzie ozzie; setUpAll(() async {
driver = await FlutterDriver.connect(); ozzie = Ozzie.initWith(driver, groupName: 'counter'); }); tearDownAll(() async { if (driver != null) driver.close(); ozzie.generateHtmlReport(); }); test('initial counter is 0', () async { await ozzie.profilePerformance('counter0', () async { await driver.waitFor(find.text('0')); await ozzie.takeScreenshot('initial_counter_is_0'); }); }); test('initial counter is 0', () async { await ozzie.profilePerformance('counter1', () async { await driver.tap(find.byType('FloatingActionButton')); await driver.waitFor(find.text('1')); await ozzie.takeScreenshot('counter_is_1'); }); }); } 57 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
void main() { FlutterDriver driver; Ozzie ozzie; setUpAll(() async {
driver = await FlutterDriver.connect(); ozzie = Ozzie.initWith(driver, groupName: 'counter'); }); tearDownAll(() async { if (driver != null) driver.close(); ozzie.generateHtmlReport(); }); test('initial counter is 0', () async { await ozzie.profilePerformance('counter0', () async { await driver.waitFor(find.text('0')); await ozzie.takeScreenshot('initial_counter_is_0'); }); }); test('initial counter is 0', () async { await ozzie.profilePerformance('counter1', () async { await driver.tap(find.byType('FloatingActionButton')); await driver.waitFor(find.text('1')); await ozzie.takeScreenshot('counter_is_1'); }); }); } 57 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
58 — Flutter Europe 2020 / Jorge Coca @ Very
Good Ventures -
59 — Flutter Europe 2020 / Jorge Coca @ Very
Good Ventures -
Recap 60 — Flutter Europe 2020 / Jorge Coca @
Very Good Ventures -
Recap → Complex problems, simple solutions 60 — Flutter Europe
2020 / Jorge Coca @ Very Good Ventures -
Recap → Complex problems, simple solutions → Goals: Simple, productive,
cost effective, and robust 60 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Recap → Complex problems, simple solutions → Goals: Simple, productive,
cost effective, and robust → flutter_bloc by @felangelov checks all the boxes 60 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Recap → Complex problems, simple solutions → Goals: Simple, productive,
cost effective, and robust → flutter_bloc by @felangelov checks all the boxes → lumberdash and ozzie flutter_bloc 60 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Stay in touch! 61 — Flutter Europe 2020 / Jorge
Coca @ Very Good Ventures -
Stay in touch! → @jcocaramos 61 — Flutter Europe 2020
/ Jorge Coca @ Very Good Ventures -
Stay in touch! → @jcocaramos → Chicago Flutter Meetup 61
— Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Stay in touch! → @jcocaramos → Chicago Flutter Meetup →
Very Good Ventures ! 61 — Flutter Europe 2020 / Jorge Coca @ Very Good Ventures -
Happy coding! !" 62 — Flutter Europe 2020 / Jorge
Coca @ Very Good Ventures