Skip to main content

Posts

Showing posts with the label firestore

A month of Flutter: user registration refactor with reactive scoped model

Originally published on bendyworks.com . Yesterday I implemented  saving new users to Firestore but I wasn't happy with the implementation. So today I refactored  everything , well not everything but a lot. There are still areas for improvement but I like the general pattern being used now. Now there is a top level  ScopedModel  that tracks the current authentication status. This sets up a listener on  FirebaseAuth  and  Firestore  and will get pushed changes when either have changed. Children widgets that need to change functionality based on authentication status will get rerendered as needed. A couple of the less important changes that I'll get out of the way now. Auth  was renamed to  AuthService The Firestore rules were updated to allow a user to read their own user document Registration/sign in success  SnackBar  was replaced with an unstyled welcome view HomePage  got  routeName  added In...