resolveOrCreate method Null safety

Variable<T> resolveOrCreate(
  1. String name,
  2. {T? value,
  3. bool? constant}

Finds the variable with the given name, either within this scope or an ancestor. Creates a new variable if none was found.

If a new variable is created, you may optionally give it a value. You can also mark the new variable as a constant.


Variable<T> resolveOrCreate(String name, {T? value, bool? constant}) {
  var resolved = resolve(name);
  if (resolved != null) return resolved;
  return create(name, value: value, constant: constant);