I am using flutter_riverpod: ^1.0.3
I am trying to write a widget test. I have ChangeNotifierProvider like the code below
final customerDataControllerProvider = ChangeNotifierProvider<CustomerDataController>((ref) {
return CustomerDataController();
});
and here is the CustomerDataController class
class CustomerDataController with ChangeNotifier {
//
}
The argument type 'MockCustomerDataController' can't be assigned to the parameter type 'ChangeNotifierProvider'.
I am confused, how to 'replace' my CustomerDataController class to my Mock class ?
CodePudding user response:
Try overrideWithValue, see Testing.

