You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been struggling to send a custom error from within a flutter isolate.
I followed all the documentation, but I keep getting
Context
This is how I setup my isolates
Future<R> isolateRun<R>(FutureOr<R> Function() callback,
{String? debugName}) async {
finalRootIsolateToken? token =RootIsolateToken.instance;
assert(token !=null);
Isolate.current.addErrorListener(RawReceivePort((pair) async {
finalList<dynamic> errorAndStacktrace = pair;
awaitFirebaseCrashlytics.instance.recordError(
errorAndStacktrace.first,
errorAndStacktrace.last,
);
}).sendPort);
returnawaitIsolate.run(() async {
BackgroundIsolateBinaryMessenger.ensureInitialized(token!);
DartPluginRegistrant.ensureInitialized();
awaitinitFirebase(); // This is where I call Firebase.initializeApp and define FlutterError.onError and PlatformDispatcher.instance.onErrorreturncallback();
}, debugName: debugName);
} else {
returnawaitcomputation();
}
}
in the callback, I parse a fairly long JSON list, and my idea was to receive a Crashalytics report whenever one or more of the items in the list would fail parsing.
Something like
awaitisolateRun<List<Item>>(() {
returnjsonDecode(response)
.map<Item?>((tagJson) {
try {
returnItem.fromJson(tagJson);
} catch (e) {
getLogger().e("Could not parse this item ID $tagJson['id']}");
FirebaseCrashlytics.instance.recordError(
e,
s,
reason:"Could not parse this item",
information: [tagJson],
);
returnnull;
}
})
.whereType<Item>()
.toList();
});
However, I have spent a few hours trying all possible combinations, and I keep getting this error whenever I call FirebaseCrashlytics.instance.recordError
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there,
I have been struggling to send a custom error from within a flutter isolate.
I followed all the documentation, but I keep getting
Context
This is how I setup my isolates
in the callback, I parse a fairly long JSON list, and my idea was to receive a Crashalytics report whenever one or more of the items in the list would fail parsing.
Something like
However, I have spent a few hours trying all possible combinations, and I keep getting this error whenever I call
FirebaseCrashlytics.instance.recordError
Any idea of the issue? Am I missing something?
Beta Was this translation helpful? Give feedback.
All reactions