needsDynamicResolution method

bool needsDynamicResolution(
  1. VscodeLaunchEntry? entry, [
  2. Iterable<String?> additional = const []
])

Returns true if the given entry or any of the additional strings contain VS Code variables that depend on the active editor state.

Implementation

bool needsDynamicResolution(VscodeLaunchEntry? entry,
    [Iterable<String?> additional = const []]) {
  if (entry != null) {
    if (_dynamicVariableRegex.hasMatch(entry.program)) return true;
    if (entry.cwd case final cwd? when _dynamicVariableRegex.hasMatch(cwd)) {
      return true;
    }
    if (entry.flutterMode case final mode?
        when _dynamicVariableRegex.hasMatch(mode)) {
      return true;
    }
    if (entry.flavorName case final flavor?
        when _dynamicVariableRegex.hasMatch(flavor)) {
      return true;
    }
    if (entry.deviceId case final device?
        when _dynamicVariableRegex.hasMatch(device)) {
      return true;
    }
    if (entry.toolArgs.any(_dynamicVariableRegex.hasMatch)) return true;
    if (entry.args.any(_dynamicVariableRegex.hasMatch)) return true;
    if (entry.env.values.any(_dynamicVariableRegex.hasMatch)) return true;
  }
  for (final s in additional) {
    if (s case final val? when _dynamicVariableRegex.hasMatch(val)) {
      return true;
    }
  }
  return false;
}