pulseOfByType function
Implementation
PulseBase<dynamic> pulseOfByType(BuildContext context, Type type) {
PulseBase? found;
void visitor(Element element) {
if (element.widget is PulseProvider) {
final provider = element.widget as PulseProvider;
if (provider.pulse.runtimeType == type) {
found = provider.pulse;
}
}
if (found == null) element.visitChildElements(visitor);
}
context.visitChildElements(visitor);
if (found == null) {
throw FlutterError('No PulseProvider<$type> found in context');
}
return found!;
}