run abstract method

Future run({
  1. required dynamic functionName,
  2. required dynamic arguments,
  3. Future fallback()?,
})

functionName can be a String or a List of String

this will be called by the worker like below:

const callback = self[functionName];
// or
const length = functionName.length;
let callback = self[functionName[0]];
for (let i = 1; i < length; i++) {
  callback = callback[functionName[i]];
}

arguments the arguments that will be applied to the callback defined by functionName

// if we need to call the JSON.stringify function:
// functionName = ['JSON','stringify'];
const callback = self[functionName];
const result = callback(arguments);

Implementation

Future<dynamic> run({
  required dynamic functionName,
  required dynamic arguments,
  Future<dynamic> Function()? fallback,
});