isPotentiallyMutatedInScope method

  1. @override
bool isPotentiallyMutatedInScope(
  1. VariableElement variable
)
override

If variable is a local variable or parameter declared anywhere within the top level function or method containing this FunctionBody, return a boolean indicating whether variable is potentially mutated within the scope of its declaration.

If variable is not a local variable or parameter declared within the top level function or method containing this FunctionBody, return false.

Throws an exception if resolution has not yet been performed.

Implementation

@override
bool isPotentiallyMutatedInScope(VariableElement variable) {
  if (localVariableInfo == null) {
    throw StateError('Resolution has not yet been performed');
  }
  return localVariableInfo!.potentiallyMutatedInScope.contains(variable);
}