MessageListener constructor
MessageListener()
Implementation
factory MessageListener({
Key? key,
required Widget child,
String? Function(dynamic)? errorExtractor,
String? Function(dynamic)? infoExtractor,
required ProviderBase provider,
required void Function(String error) showError,
required void Function(String error) showInfo,
}) {
if (provider is StateNotifierProvider) {
return MessageListener._stateNotifier(
provider: provider,
showError: showError,
showInfo: showInfo,
errorExtractor: errorExtractor,
infoExtractor: infoExtractor,
child: child);
} else if (provider is AutoDisposeStateNotifierProvider) {
return MessageListener._autoDisposeStateNotifier(
provider: provider,
showError: showError,
showInfo: showInfo,
errorExtractor: errorExtractor,
infoExtractor: infoExtractor,
child: child);
} else if (provider is ChangeNotifierProvider) {
return MessageListener._changeNotifier(
provider: provider,
showError: showError,
showInfo: showInfo,
errorExtractor: errorExtractor,
infoExtractor: infoExtractor,
child: child);
} else if (provider is AutoDisposeChangeNotifierProvider) {
return MessageListener._autoDisposeChangeNotifier(
provider: provider,
showError: showError,
showInfo: showInfo,
errorExtractor: errorExtractor,
infoExtractor: infoExtractor,
child: child);
} else {
throw UnimplementedError(
'riverpod_messages supports only StateNotifier or ChangeNotifier');
}
}