Dart: function's parameter notation Dart: function's parameter notation dart dart

Dart: function's parameter notation


In

return compute(parsePhotos, response.body);

parsePhotos and response.body are just two independent parameters.The first is a reference to the parsePhotos function passed to the computes callback parameter, and the second is is the response data from client.get(...) that is passed to the message parameter of the compute function.

What compute does is to create a new isolate with parsePhotos as entry point (like main() for the main isolate) and then passes message to it as parameter.

So it is not this line return compute(parsePhotos, response.body); that passes response.body to parsePhotos but

final Isolate isolate = await Isolate.spawn(    _spawn,    new _IsolateConfiguration<Q, R>(      callback,      message,

from the compute implementation https://docs.flutter.io/flutter/foundation/compute.html