get method

Future<String?> get(
  1. String param
)

Returns the value of a variable in the script file.

The param parameter is the name of the variable.

Returns null if the variable is not found or the file does not exist.

Implementation

Future<String?> get(String param) async {
  final script = await contents();
  if (script == null) {
    return null;
  }
  final regex = RegExp('readonly $param="(.*)"');
  final match = regex.firstMatch(script);

  final value = match?.group(1);

  return value;
}