guardBrudcastCall<T> function

Future<T?> guardBrudcastCall<T>(
  1. String name,
  2. Future<T> call()
)

Runs a call to the native SDK, logging instead of throwing when it fails, so no SDK call throws into the app.

name names the call in the log.

Implementation

Future<T?> guardBrudcastCall<T>(String name, Future<T> Function() call) async {
  try {
    return await call();
  } catch (error) {
    BrudcastLog.error('$name failed: $error');
    return null;
  }
}