unawaitedCatch function

void unawaitedCatch(
  1. Future<void> func()
)

Implementation

void unawaitedCatch(Future<void> Function() func) {
  final hostStack = StackTrace.current;
  unawaited(() async {
    try {
      await func();
    } catch (e, stack) {
      final host = LimitedStackTrace(
        stackTrace: hostStack,
        skipFirst: 1,
      );
      Fimber.e('$e', stacktrace: StackTrace.fromString('$stack$host'));
    }
  } ());
}