recipeOf<T extends Equatable> function
T
recipeOf<T extends Equatable>({
- required BuildContext context,
- required T fallbackData,
- required bool listen,
Returns the recipe of type T
from the context, or fallbackData
if no
recipe was found.
Implementation
T recipeOf<T extends Equatable>({
required BuildContext context,
required T fallbackData,
required bool listen,
}) {
try {
return Provider.of<T>(context, listen: listen);
} on ProviderNotFoundException {
return fallbackData;
}
}