This is feature request is a improvement proposal for adding a copyWith method that would allow changing the ApiClient's objects without depending directly on them.
Example:
class User {
final String id;
final String name;
const User({
required this.id,
required this.name,
});
User copyWith({
String? id,
String? name,
}) {
return User(
id: id ?? this.id,
name: name ?? this.name,
);
}
}
Use case:
// get user from api
final user = await apiClient.getUser();
// update user name keeping the id
final updatedUser = user.copyWith(name: 'New Name');
await apiClient.updateUser(newUser);
This is feature request is a improvement proposal for adding a
copyWithmethod that would allow changing theApiClient's objects without depending directly on them.Example:
Use case: