function static method

String function({
  1. required String name,
  2. List<String> args = const [],
  3. required String body,
})

Build the declaration of a javascript function.

name is the name of the function. args are the parameters accepted by the function. body is the code that will be executed when the function is called.

Implementation

static String function({
  required String name,
  List<String> args = const [],
  required String body,
}) =>
    "function $name(${args.join(",")}) { $body }";