initFimberInIsolate static method

Future<void> initFimberInIsolate()

Implementation

static Future<void> initFimberInIsolate() async {
  if (_isInitializedInMain) {
    Fimber.e('Fimber is already initialized', stacktrace: StackTrace.current);
    return;
  }

  if (_isInitializedInIsolate) return;
  _isInitializedInIsolate = true;

  Fimber.plantTree(_ReportingTreeIsolate());

  Isolate.current.addErrorListener(RawReceivePort((pair) async {
    final List<String> errorAndStacktrace = pair;
    Fimber.e(errorAndStacktrace.first, stacktrace: StackTrace.fromString(errorAndStacktrace.last));
  }).sendPort);
}