call method Null safety

dynamic call(
  1. [List args = const [],
  2. Map<String, dynamic>? namedArgs]
)

Implementation

dynamic call([List args = const [], Map<String, dynamic>? namedArgs]) {
  final runInfo = _controller.startAction();

  try {
    // Invoke the actual function
    if (namedArgs == null) {
      return Function.apply(_fn, args);
    } else {
      // Convert to symbol-based named-args
      final namedSymbolArgs =
          namedArgs.map((key, value) => MapEntry(Symbol(key), value));
      return Function.apply(_fn, args, namedSymbolArgs);
    }
  } finally {
    _controller.endAction(runInfo);
  }
}