xwidget_el 0.7.0 copy "xwidget_el: ^0.7.0" to clipboard
xwidget_el: ^0.7.0 copied to clipboard

A powerful expression language designed for evaluating expressions within a data model.

0.7.0 #

  • Core property coverage is now complete for every supported type — the hand-written resolver's surface is the contract the future generated resolver must reproduce, so completeness is required for the 0.8 mechanism swap to be behavior-neutral. Added: codeUnits/runes (String), single/iterator (Iterable), reversed (List), bitLength (int), inMicroseconds (Duration), and millisecond/microsecond/ microsecondsSinceEpoch/timeZoneName/timeZoneOffset (DateTime). Policy: all public instance getters except Object members; single follows Dart semantics (StateError when unsatisfiable), consistent with first/last.
  • Added Uri to the core property types: scheme, host, port, path, pathSegments, query, queryParameters, queryParametersAll, fragment, authority, userInfo, origin, data, isAbsolute, and the has* flags. queryParameters/queryParametersAll traverse as Maps (${link.queryParameters.id}).

0.6.0 #

  • Dart-like property access in paths — a path segment that isn't a Map key or List index now resolves core Dart getters on the value: length/isEmpty/isNotEmpty on String, List, Set, and Map; first/last on iterables (Dart semantics — StateError on empty); keys/values/entries on Maps (a real key always wins); numeric flags (isEven, isOdd, isNegative, isNaN, isFinite, isInfinite, sign); and common Duration/DateTime getters. Works in EL (${tags.length}) and Dart (data.getValue("tags.length")); property access on a null chain remains null.
  • Custom property resolutionregisterPropertyResolver(resolver) adds property support for custom types, mirroring registerMethodResolver. Resolvers run after the built-in core properties, in registration order; the first non-null [PropertyResolution] wins.
  • Removed the matches instance-method dispatchgetDynamicFunctionOn no longer resolves matches on a value. The case returned a member tear-off that no Dart type provides, so every invocation threw NoSuchMethodError; no working code could have depended on it. The static matches(value, regExp) function (full-string match, returns bool) is unchanged.
  • registerMethodResolver is now exported — the package barrel only exported registerFunction, so the custom method dispatch added in 0.5.0 (and its InstanceMethodResolver typedef) was unusable without a src/ import.
  • Minimum Dart SDK is now 3.9; minimum Flutter is 3.35, aligning with the rest of the XWidget 0.6 suite.

0.5.0 #

  • Custom instance method dispatchregisterMethodResolver(resolver) allows registering resolvers that handle instance method calls on custom types. Resolvers run after built-in instance methods in [getDynamicFunctionOn], in registration order; the first non-null result wins.

  • Expanded toDuration int unit aliases — When converting an int to a Duration, intUnit now accepts long-form aliases for every unit:

    • days: d, day, days
    • hours: h, hour, hours
    • minutes: M, min, mins, minutes
    • seconds: s, sec, secs, seconds
    • milliseconds: ms, milli, millis, milliseconds

    Defaults to milliseconds when intUnit is omitted or null.

  • Expanded parseDuration string unit aliases — String parsing now accepts sec/secs for seconds, minutes for minutes, and hours for hours, alongside the existing short forms.

  • Fixed the entries instance function on Mapcase "entries" in getDynamicFunctionOn was returning the iterable directly instead of a closure, causing Function.apply to throw on invocation. Now wrapped consistently with keys and values.

  • toDuration no longer silently falls through to milliseconds — Previously, an unrecognized intUnit produced a millisecond-based Duration due to default fall-through. Unrecognized units now throw an exception.

  • Completed test coverage for static and instance dynamic EL functions, including converters, validators, formatters, set operations, isInfinite/isNaN, lastIndexOf, replaceRange, and the new entries and registerMethodResolver paths.

0.4.0 #

  • New EL formatter functions
    • formatNumber(value, pattern) — ICU/intl number formatting with grouping, decimals, and currency support.
    • formatPercent(value, decimalPlaces) — Formats a decimal as a percentage string.
    • formatBytes(value, decimalPlaces) — Human-readable byte sizes (B, KB, MB, GB, TB).
    • formatCompact(value, decimalPlaces) — Compact number suffixes (K, M, B, T).
    • formatOrdinal(value) — English ordinal suffixes (1st, 2nd, 3rd, 4th).
    • formatPlural(count, singular, plural) — Count-aware label pluralization.
    • formatElapsed(dateTime) — Relative time strings ("5 minutes ago", "in 3 hours").
  • New EL math functions
    • min(a, b) — Returns the smaller of two comparable values.
    • max(a, b) — Returns the larger of two comparable values.
    • clamp(value, lower, upper) — Constrains a value to a range.
  • New EL static functions
    • first(value) — Returns the first element of a List, Set, or Map.
    • last(value) — Returns the last element of a List, Set, or Map.
  • Custom function registrationregisterFunction(name, func) allows registering user-defined static EL functions at startup. Resolution order: built-in → registered → dependency.
  • Ternary expressions now accept dynamic conditionsConditionalExpression condition type widened from Expression<bool> to Expression, allowing function calls that return bool to be used directly as ternary conditions (e.g., isAdmin() ? 'yes' : 'no'). Non-bool conditions throw a clear runtime error.
  • Added 405 tests across 7 test files covering formatters, math, misc, converters, validators, dynamic functions, and conditional expressions.

0.3.1 #

  • Updated minimum Dart SDK to 3.8.
  • Minor documentation updates.

0.3.0 #

  • Updated minimum Flutter version to 3.10.0.
  • Updated minimum Dart SDK to 3.4.
  • Fixed runtimeType instance function using incorrect casing in getDynamicFunctionOn.
  • Fixed missing return for values instance function in getDynamicFunctionOn.

0.2.2 #

  • Changed logging package from logger to logging.

0.2.1 #

  • Resolved code linting warnings
  • Expanded developer documentation throughout the codebase

0.2.0 #

  • Updated petitparser dependency to ^7.0.1
  • Fixed issue with ELParserDefinition's build and buildFrom methods.

0.1.0 #

  • Initial release.
6
likes
160
points
189
downloads

Documentation

API reference

Publisher

verified publisherappfluent.us

Weekly Downloads

A powerful expression language designed for evaluating expressions within a data model.

Repository (GitHub)
View/report issues

Topics

#data-model #data-transformation #expression-language #parser #reactive

License

MIT (license)

Dependencies

flutter, intl, logging, petitparser, type_plus

More

Packages that depend on xwidget_el