withCapability<T, R> static method
Execute action safely with capability check Returns null if capability not supported
Implementation
static Future<R?> withCapability<T, R>(
dynamic provider,
Future<R> Function(T) action,
) async {
if (provider is T) {
return await action(provider);
}
return null;
}