| Type of future | When it's ready, I'll have a ... |
|---|---|
| Future<String> | ... string |
| Future<Foo> | ... Foo |
| Future> | ... Map whose keys are Strings and whose values are dynamic. |
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
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| appBar: AppBar(title: Text("Prestige Worldwide Registration")), | |
| // TODO 1: Wrap the body in a Form widget | |
| body: Form( // <-- Add this widget. (Don't forget to close it!) | |
| child: Container( | |
| alignment: Alignment.center, | |
| child: Column( | |
| children: <Widget>[ |
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
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| appBar: AppBar(title: Text("Prestige Worldwide Registration")), | |
| // TODO 1: Wrap the body in a Form widget | |
| body: Container( | |
| alignment: Alignment.center, | |
| child: Column( | |
| children: <Widget>[ | |
| _buildEmailField, |
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
| import 'package:flutter/material.dart'; | |
| import 'package:cloud_firestore/cloud_firestore.dart'; | |
| class PeopleUpsert extends StatefulWidget { | |
| @override | |
| _PeopleUpsertState createState() => _PeopleUpsertState(); | |
| } | |
| class _PeopleUpsertState extends State<PeopleUpsert> { | |
| GlobalKey<FormState> _key = GlobalKey<FormState>(); |
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
| // Say goReadAFile() is slow and returns a Future | |
| Future myFuture = goReadAFile(); |
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
| class FooState extends State<FooComponent> { | |
| String _firstName; // <-- A variable known by the whole class | |
| Widget build(BuildContext context) { | |
| // return a widget | |
| } | |
| void _myCallback(String someVar) { | |
| _firstName = someVar; // <-- Getting a value OUT of an async callback | |
| } | |
| } |
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
| Future<Bar> someFunction() async { | |
| Foo theIncomingData = await somethingThatReturnsAFuture(); | |
| return new Bar(); | |
| } |
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
| Bar someFunction() { | |
| Foo theIncomingData = someFunction(); | |
| return new Bar(); | |
| } |
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 myCallback(Foo theIncomingData) { | |
| doSomethingWith(theIncomingData); | |
| } |
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
| @override | |
| Widget build(BuildContext context) { | |
| return StoreProvider<AppState>( | |
| store: this.store, | |
| child: StoreConnector<AppState, AppState>(converter: (store) { | |
| return store.state; | |
| }, | |
| builder: (context, callback) { | |
| if (store.state.showFilmDetails) // <-- 9 | |
| return showFilmDetails(this.store.state.selectedFilm); // <-- 9 |