Speaking in general, you should do Interface-Oriented Programming at some level, which means: talk to your partner and align what each side expects.
But your question specifically asks about models. There's no correct answer, but what I would suggest you to do is:
- create the model as in your example:
class UserModel {
final String name;
final String surname;
}
- use the repository pattern to shield your UI/Controller from changes in models
abstract class UserRepository {
Future<UserModel> getUser();
}
class UserFakeRepository implements UserRepository {
@override
Future<UserModel> getUser() {
final result = UserModel('John', 'Doe');
}
}
- in your UI/Controller layer you should use the repository instead of feeding the UI directly with the data:
class _UserPageState extends State<UserPage> {
UserModel? user;
@override
void initState() {
_repository.getUser().then((result) =>
setState(() {
user = result;
}));
}
}
- after the Firebase part is built, you can implement a new UserRepository and change your dependency injection (meaning, stop using UserFakeRepository and use this new one):
class UserFirebaseRepository implements UserRepository {
@override
Future<UserModel> getUser() {
final result = _firebase.query(...);
}
}
for unit testing purposes, I advise you to create a wrapper for Firebase.instance. If you use them directly in your repositories, you'll be unable to write unit tests for your repositories.
by writing code this way, your UI layer will remain unchanged when you integrate the app with Firebase.