Skip to main content

kodi_script 0.4.0 copy "kodi_script: ^0.4.0" to clipboard
kodi_script: ^0.4.0 copied to clipboard

A lightweight, embeddable scripting language for Dart applications.

Changelog #

0.4.0 #

Added #

  • Array natives: chunk, compact, pluck, zip, fromEntries, difference, intersection, union. A null list behaves as an empty list.
  • Grouping builtins groupBy, countBy, indexBy, uniqueBy, sumBy, minBy, maxBy, partition, next to map and filter. The key is a dotted path or a function fn(item, index).
  • Date natives: parseDate, isDate, toISO, addMonths, addYears, addMinutes, addSeconds, diffHours, diffMinutes, diffMonths, diffYears, age, startOfDay, endOfDay, startOfMonth, endOfMonth, daysInMonth, isWeekend.
  • formatDate knows the YY and SSS tokens.

Changed #

  • Date functions accept ISO-8601 text (2026-10-19, 2026-10-19T08:30:00+01:00) as well as milliseconds. Fields are validated strictly: 2026-02-29 is not a date.
  • A date that cannot be read gives null instead of raising (timestamp, formatDate, year, month, day, hour, minute, second, dayOfWeek, addDays, addHours, diffDays).
  • Every calendar computation is done in UTC instead of the host's time zone, including date(), time(), datetime() and the calendar fields. datetime() now returns YYYY-MM-DDTHH:mm:ss.SSSZ.

0.3.0 #

  • Array literals and call arguments accept a trailing comma, so a literal can be laid out one element per line (objects already did).

0.2.0 #

Breaking Changes #

  • Binding API: Objects passed to .bind() must now implement KodiBindable interface
    • This enables support for iOS, Android, and Web platforms
    • Removed dependency on dart:mirrors which is not available on these platforms

Migration Guide #

Before (0.1.x):

// Automatic reflection - no longer supported
class User {
  final String name;
  User(this.name);
  String greet() => "Hello, $name!";
}
final result = KodiScript.builder('user.greet()').bind('user', User('Alice')).execute();

After (0.2.0):

class User implements KodiBindable {
  final String name;
  User(this.name);
  String greet() => "Hello, $name!";

  @override
  Object? getProperty(String name) => name == 'name' ? this.name : null;

  @override
  Object? callMethod(String name, List<Object?> args) {
    if (name == 'greet') return greet();
    return null;
  }
}
final result = KodiScript.builder('user.greet()').bind('user', User('Alice')).execute();

0.1.1 #

  • Fixed string template parsing for complex expressions
  • Improved error messages for undefined variables
  • Performance optimizations for repeated script execution

0.1.0 #

  • Added for...in loop support for iterating over arrays
  • Added while loop support for conditional iteration
  • Added user-defined functions with fn keyword
  • Enhanced array operations: map, filter, reduce, find, findIndex
  • Added operation limit and timeout for script execution
  • Performance improvements via AST caching

0.0.1 #

  • 🎉 Initial release
  • Variables and expressions
  • Null-safety operators (?., ?:)
  • Control flow (if/else)
  • Native functions:
    • String manipulation
    • Math operations
    • Crypto (MD5, SHA1, SHA256)
    • JSON parsing/stringify
    • Base64/URL encoding
    • Array operations
  • Custom function registration
  • Builder pattern API
1
likes
150
points
358
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A lightweight, embeddable scripting language for Dart applications.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

crypto

More

Packages that depend on kodi_script