ArcadeEvaluator class final

This object allows you to evaluate an ArcadeExpression under a given ArcadeProfile.

This Object allows you to set up, execute and query information about an Arcade script. For more general information on Arcade and its usages we refer you to the Arcade online documentation.

To construct the ArcadeEvaluator object you need to supply an ArcadeExpression along with an ArcadeProfile. ArcadeExpression is an object that contains the Arcade script plus some additional metadata while ArcadeProfile specifies availability of profile variables and limits what functions are available.

The basic workflow is:

From an ArcadeEvaluator object you can query information to determine:

  • Which profile variables are accessed by the script.
  • Which attributes are used by a particular profile variable.
  • If the script is considered stable.

Not all scripts use all the profiles variables. ArcadeEvaluator.profileVariablesUsed returns an array of the names of the profile variables used in the current script. Possible uses include:

  • Informing dependency analysis to determine which scripts need to run when a value of a profile variable changes.
  • Minimizing expensive calculation of unneeded profile variables.

ArcadeEvaluator.getAttributesUsingFeatureTable lets you dig deeper to determine which attributes are required on a specific profile variable. If you are querying a subset of attributes when querying a feature, use this information to ensure the profile variable will have the attributes it requires.

ArcadeEvaluator.isStable property indicates if the given script will return the same value for an identical set of profile variables. For this to be true a script must avoid using unstable builtin functions such as now() or random().

ArcadeEvaluator.isStable can be combined with the knowledge of the used profile variables to construct caches of results. This lets you avoid running scripts when repeated calls with the same profiles variables will not alter the evaluation result.

Implemented types
Mixed-in types

Constructors

ArcadeEvaluator(ArcadeExpression expression, ArcadeProfile profile)
Creates an ArcadeEvaluator object.
factory

Properties

expression ArcadeExpression
The Arcade expression of the Arcade evaluator.
no setter
hashCode int
The hash code for this object.
no setterinherited
isStable bool
Is a script is considered stable.
no setter
loadError ArcGISException?
The load error.
no setterinherited
loadStatus LoadStatus
The load status.
no setterinherited
onLoadStatusChanged Stream<LoadStatus>
A stream that reports changes to the LoadStatus.
no setterinherited
profile ArcadeProfile
The Arcade profile under which the script should evaluate.
no setter
profileVariablesUsed List<String>
An array of strings containing the names of all profile variables used in the script.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancelLoad() → void
Cancels loading metadata for the object.
inherited
evaluate({Map<String, dynamic> profileVariables = const {}}) Future<ArcadeEvaluationResult>
Evaluate the script using the supplied profile variables.
getAttributesUsingFeatureTable({required String variableName, required FeatureTable attributeNameSource}) Future<List<String>>
An array of attributes used in the script for a given profile variable.
getAttributesUsingGeoElement({required String variableName, required GeoElement attributeNameSource}) Future<List<String>>
An array of attributes used in the script for a given profile variable.
hasUndeterminedAttributeReferences({required String variableName}) bool
True if the script contains ambiguous or undetermined attribute references.
load() Future<void>
Loads the metadata for the object asynchronously.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
retryLoad() Future<void>
Loads or retries loading metadata for the object asynchronously.
inherited
toString() String
A string representation of this object.
inherited
usesGeometry({required String variableName}) bool
True if geometry is used in the script for a given profile variable, false otherwise.

Operators

operator ==(Object other) bool
The equality operator.
inherited