Skip to main content

Posts

Showing posts with the label firebase

A month of Flutter: WIP save users to Firestore

Originally published on bendyworks.com . Today was supposed to be simple. Take  form values ,  save them in Firestore . It works but the current implementation is messy so I'm going to walk through the work in progress (WIP) code and refactor it tomorrow. The larger architectural change was creating a  UserService to handle getting and creating users. This approach works but creates a complex dependency injection pattern that requires a lot of duplicate code and mocking in test. These are some of the current changes and what I don't like about the implementation: RegisterPage  now takes a  UserService  which in turn takes  FirebaseAuth  and  Firestore  instances. Doing this once wouldn't be so bad but I've had to instantiate  UserService  in several places. I'd like to find a better approach than  UserService . RegisterPage ( userService: UserService ( firebaseAuth: FirebaseAuth . instance , fire...