setExecutionCallback static method

dynamic setExecutionCallback(
  1. Future action(
    1. Map<String, dynamic> initialData
    )
)

set the code you want to run when foreground-service is ordered to start from application side using AppClient.execute(serviceData) you receive the ServiceData passed in that method as initialData in your callback

Implementation

static setExecutionCallback(Future action(Map<String, dynamic> initialData)) {
  channel.setMethodCallHandler((call) async {
    var json = jsonDecode(call.arguments as String);
    await action(json);
  });
}