Refactored the bridge to use load the JVM in a separate Isolate that receives messages in a queue executing them, this way it doesn't block the UI thread
This commit is contained in:
35
lib/jni_isolate_message.dart
Normal file
35
lib/jni_isolate_message.dart
Normal file
@@ -0,0 +1,35 @@
|
||||
class JniIsolateMessage {
|
||||
final int id;
|
||||
final JniIsolateMessageType type;
|
||||
final Map<String, dynamic> args;
|
||||
|
||||
JniIsolateMessage({required this.id, required this.type, required this.args});
|
||||
}
|
||||
|
||||
class JniIsolateResponse {
|
||||
final int id;
|
||||
final dynamic results;
|
||||
|
||||
JniIsolateResponse({required this.id, this.results});
|
||||
}
|
||||
|
||||
class JniIsolateError {
|
||||
final int id;
|
||||
final String error;
|
||||
final String stackTrace;
|
||||
|
||||
JniIsolateError({required this.id, required this.error, required this.stackTrace});
|
||||
}
|
||||
|
||||
enum JniIsolateMessageType {
|
||||
getAnimeSearchResults,
|
||||
getMangaSearchResults,
|
||||
getEpisodeList,
|
||||
getChapterList,
|
||||
getVideoList,
|
||||
getPageList,
|
||||
loadAnimeExtension,
|
||||
loadMangaExtension,
|
||||
unloadAnimeExtension,
|
||||
unloadMangaExtension,
|
||||
}
|
||||
Reference in New Issue
Block a user