retrieve the user from the local database (or shared preferences)
keep in memory the current user
What needs to be done
Use freezed (and Isar if user is stored in the database) to implement the User, and UserPreferences models
Create a UserDataLoader class that:
synchronize the user with the API (depends on API #16)
Create a UserService class that has the following function:
retrieve the user from the database or shared preferences
Future<bool> updateUser(User updatedUser) which update the locally stored user with a new one then synchronize with the API if necessary ((depends on API #15)
As a developer, I want to have a place to interact with the user data and functions
Requirements
You can find the user definition here
Implement a repository that:
What needs to be done
User
, andUserPreferences
modelsUserDataLoader
class that:UserService
class that has the following function:Future<bool> updateUser(User updatedUser)
which update the locally stored user with a new one then synchronize with the API if necessary ((depends on API #15)throw UnimplementedError()
) for:Future<bool> deleteUser(User user)
;AuthenticationMethod
with the values:google
,apple
,classic
,anonymous
UserRepository
class as a listenable service, and add it to the locator. It should have the following methods:User self
that returns the user connected (registered aslistenToReactiveValues
)Future<bool> signOut()
which clear the current userthrow UnimplementedError()
) for:Future<bool> signIn(AuthenticationMethod method, {bool isSilent = false, String? email, String? password})
Future<bool> register()
Future<bool> updateSelf(User updatedUser)
;Future<bool> linkAccount(AuthenticationMethod method, {String? email, String? password})
Future<bool> deleteUser()
;Future<bool> updatePassword(String oldPassword, String newPassword)
UserRepository
andUserDataLoader
Dependencies
Child of #130
Depends on: