Closed youngchan1988 closed 3 years ago
The exception throw by the code:
@override Future<R> run<R, P>(FutureOr<R>? Function(P argument) function, P argument, {Duration? timeout, FutureOr<R> Function()? onTimeout}) { return singleResultFuture<R>((SendPort port) { _commandPort.send(list4(_run, function, argument, port)); }, timeout: timeout, onTimeout: onTimeout); }
in isolate_runner.dart. What I am curious about is the SendPort can only transfer primitive values. https://api.dart.dev/stable/2.13.0/dart-isolate/SendPort/send.html
SendPort
The content of message can be: primitive values (null, num, bool, double, String), instances of SendPort, and lists and maps whose elements are any of these. List and maps are also allowed to contain cyclic references.
So why send the function type argument?
The exception throw by the code:
in isolate_runner.dart. What I am curious about is the
SendPort
can only transfer primitive values. https://api.dart.dev/stable/2.13.0/dart-isolate/SendPort/send.htmlSo why send the function type argument?