Let s say I have 3 ChangeNotifierProviders "Auth1","Auth2","Auth3". I want all of them to implement login(),signup(),isAuthenticated().
So that I can replace one provider with another whenever I want.
//Interface
class IAuth {
Future<void> signUp(String email, String password)=>throw UnimplementedError();
Future<void> login(String email, String password) => throw UnimplementedError();
Future<bool> isAuthenticted() => throw UnimplementedError();
void logout() => throw UnimplementedError();
}
I can define
class Auth1 extends ChangeNotifier implements IAuth { ... }
class Auth2 extends ChangeNotifier implements IAuth { ... }
class Auth3 extends ChangeNotifier implements IAuth { ... }
But how can I provide the providers, in such a way that I can replace them without any problem in the future?
ChangeNotifierProvider.value(value: Auth1())
After sometime, I may want to replace Auth1 with Auth2 and also I want to know whether this is a trivial question