Update worker_manager library official for isolate
This commit is contained in:
@@ -39,13 +39,13 @@ class MailboxIsolateWorker {
|
|||||||
StreamController<Either<Failure, Success>> onProgressController
|
StreamController<Either<Failure, Success>> onProgressController
|
||||||
) async {
|
) async {
|
||||||
final result = await _isolateExecutor.execute(
|
final result = await _isolateExecutor.execute(
|
||||||
arg1: ArgumentsSendPort(MailboxMarkAsReadArguments(
|
arg1: MailboxMarkAsReadArguments(
|
||||||
_threadApi,
|
_threadApi,
|
||||||
_emailApi,
|
_emailApi,
|
||||||
accountId,
|
accountId,
|
||||||
mailboxId)),
|
mailboxId),
|
||||||
fun1: (arguments) => _handleMarkAsMailboxReadAction(arguments),
|
fun1: _handleMarkAsMailboxReadAction,
|
||||||
onUpdateProgress: (value) {
|
notification: (value) {
|
||||||
if (value is List<Email>) {
|
if (value is List<Email>) {
|
||||||
log('MailboxIsolateWorker::markAsMailboxRead(): onUpdateProgress: COUNT ${value.length}');
|
log('MailboxIsolateWorker::markAsMailboxRead(): onUpdateProgress: COUNT ${value.length}');
|
||||||
log('MailboxIsolateWorker::markAsMailboxRead(): onUpdateProgress: TOTAL $totalEmailUnread');
|
log('MailboxIsolateWorker::markAsMailboxRead(): onUpdateProgress: TOTAL $totalEmailUnread');
|
||||||
@@ -60,21 +60,10 @@ class MailboxIsolateWorker {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<List<Email>> _handleMarkAsMailboxReadAction(dynamic argumentsAction) async {
|
static Future<List<Email>> _handleMarkAsMailboxReadAction(
|
||||||
if (argumentsAction is! ArgumentsSendPort) {
|
MailboxMarkAsReadArguments args,
|
||||||
log('MailboxIsolateWorker::_handleMarkAsMailboxReadAction(): argumentsAction NOT ArgumentsSendPort');
|
TypeSendPort sendPort
|
||||||
return List.empty();
|
) async {
|
||||||
}
|
|
||||||
|
|
||||||
final args = argumentsAction.argument as MailboxMarkAsReadArguments;
|
|
||||||
final sendPort = argumentsAction.sendPort;
|
|
||||||
|
|
||||||
if (sendPort != null) {
|
|
||||||
log('MailboxIsolateWorker::_handleMarkAsMailboxReadAction(): SEND_PORT NOT NULL');
|
|
||||||
} else {
|
|
||||||
log('MailboxIsolateWorker::_handleMarkAsMailboxReadAction(): SEND_PORT NULL');
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Email> emailListCompleted = List.empty(growable: true);
|
List<Email> emailListCompleted = List.empty(growable: true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -124,9 +113,7 @@ class MailboxIsolateWorker {
|
|||||||
|
|
||||||
log('MailboxIsolateWorker::_handleMarkAsMailboxRead(): MARK_READ: ${result.length}');
|
log('MailboxIsolateWorker::_handleMarkAsMailboxRead(): MARK_READ: ${result.length}');
|
||||||
emailListCompleted.addAll(result);
|
emailListCompleted.addAll(result);
|
||||||
if (sendPort != null) {
|
sendPort.send(emailListCompleted);
|
||||||
sendPort.send(ValueUpdate(emailListCompleted));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
+1
-4
@@ -170,10 +170,7 @@ dependencies:
|
|||||||
percent_indicator: 4.2.2
|
percent_indicator: 4.2.2
|
||||||
|
|
||||||
# Isolate
|
# Isolate
|
||||||
worker_manager:
|
worker_manager: 4.4.0
|
||||||
git:
|
|
||||||
url: https://github.com/dab246/worker_manager.git
|
|
||||||
ref: improvement
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user