create static method
- Object? expression, {
- StyleExpressionOptions? options,
Parses a style [expression](https://maplibre.org/maplibre-style-spec/expressions/) to evaluate without a map.
See mln_style_expression_create in the
C API reference.
Errors:
Status.invalidArgumentwhenexpressionisn't a valid expression, or its result can't have the expected type.
Implementation
static StyleExpressionHandle create(
Object? expression, {
StyleExpressionOptions? options,
}) => withNativeArena((arena) {
ensureAbiVersion();
final outExpression = arena<Uint64>();
_check(
raw.mln_style_expression_create(
_nativeJsonView(expression, arena),
options == null
? nullptr
: _writeStyleExpressionOptions(options, arena),
outExpression,
nativeDiagnostic,
),
);
return _adoptOwned(
outExpression.value,
() =>
StyleExpressionHandle._(_NativeStyleExpression(outExpression.value)),
(handle) {
raw.mln_style_expression_release(handle);
},
);
});