Skip to content
pubscout

hetu_script

0.8.0, released 2 weeks ago by hetu.dev

A lightweight Dart scripting language for embedding in Flutter apps

WASM-ready
$ flutter pub add hetu_script
Source repository

What it does

Hetu Script lets you write and execute scripts at runtime, exposing JavaScript‑friendly APIs and allowing Dart functions to be called from script and vice versa.

AI-written summary of version 0.8.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need hot‑fix or runtime scripting in a Flutter app
  • You want to expose Dart logic to a scriptable UI or game
  • You prefer a JavaScript‑like syntax for scripting

Skip it when

  • You need a full‑blown state‑management or dependency‑injection framework
  • You require extensive third‑party integrations beyond scripting

Strengths

  • Runs on all Flutter platforms, including web and desktop
  • JavaScript‑friendly standard library makes it easy for JS developers
  • Easy binding: call Dart functions from script with one line
  • Supports async/await and modern language features

Weaknesses

  • No built‑in state‑management or UI widgets
  • Limited ecosystem compared to mainstream packages
  • Requires manual setup of bindings for Dart functions
  • Documentation is primarily in English, Chinese available

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
7

Add dependency, create Hetu instance, call init(), then eval() or use externalFunctions map

import 'package:hetu_script/hetu_script.dart';
void main(){
  final hetu = Hetu();
  hetu.init();
  hetu.eval(r'''var ht={name:'Hetu',greeting:()=>print('Hello $name!')} ; ht.greeting();''');
}

Works with

Packages commonly used together with hetu_script: ones it builds on, ones built on it, and its own family.