September 2019
Beginner
512 pages
12h 52m
English
In the RequestFavorPageState class, we need to add the code to insert a new favor in our favor collection in Firestore. This is done on the previous _save() method, which, until now, did not save anything:
// part of request_favors_page.dart file void save(BuildContext context) async { if (_formKey.currentState.validate()) { _formKey.currentState.save(); // 1 final currentUser = await FirebaseAuth.instance.currentUser(); //2 await _saveFavorOnFirebase( Favor( to: _selectedFriend.number, description: _description, dueDate: _dueDate, friend: Friend( name: currentUser.displayName, number: currentUser.phoneNumber, photoURL: currentUser.photoUrl, ), ), ); //3 Navigator.pop(context); //4 } }
The save process is defined ...
Read now
Unlock full access