SimpleEvaluationContextBuilder class final

Sets up a SimpleEvaluationContext: which methods, index accessors, conversions and root object it has.

Get one from SimpleEvaluationContext.forReadOnlyDataBinding, SimpleEvaluationContext.forReadWriteDataBinding or SimpleEvaluationContext.forPropertyAccessors, chain the with... calls you need, then call build. Everything not enabled here stays off.

// Binding a submitted form: fields may be set, and methods such as
// `name.trim()` may be called.
final context = SimpleEvaluationContext.forReadWriteDataBinding()
    .withInstanceMethods()
    .withConversionService(DefaultConversionService())
    .withRootObject(form)
    .build();

Spring (Java):

EvaluationContext context = SimpleEvaluationContext
    .forReadWriteDataBinding()
    .withInstanceMethods()
    .withConversionService(conversionService)
    .withRootObject(form)
    .build();

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

build() → SimpleEvaluationContext
Creates the context. Its accessor and resolver lists are unmodifiable: what the builder did not enable cannot be added later.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
withAssignmentDisabled() → SimpleEvaluationContextBuilder
Forbids assignment, for example in a builder from SimpleEvaluationContext.forPropertyAccessors whose properties should only be read.
withConversionService(ConversionService service) → SimpleEvaluationContextBuilder
Converts with service, typically the application's conversion service, through a StandardTypeConverter.
withIndexAccessors(List<IndexAccessor> accessors) → SimpleEvaluationContextBuilder
Adds index accessors so that target[index] works on your own indexable types; lists, maps and strings need none.
withInstanceMethods([List<MethodResolver> extra = const []]) → SimpleEvaluationContextBuilder
Lets expressions call instance methods: those of @Introspected classes in BeanIntrospector.shared (Spring's DataBindingMethodResolver) and the built-in ones of core Dart types, such as name.toUpperCase(). Off by default.
withMethodResolvers(List<MethodResolver> resolvers) → SimpleEvaluationContextBuilder
Lets expressions call only the methods resolvers offer, such as a FunctionMethodResolver listing a few methods of your own type. They are asked before the ones withInstanceMethods enables.
withRootObject(Object? root) → SimpleEvaluationContextBuilder
Sets the default root object (#root), used when getValue gets no root of its own.
withTypeConverter(TypeConverter converter) → SimpleEvaluationContextBuilder
Uses converter instead of a StandardTypeConverter over the shared DefaultConversionService.

Operators

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