@wasm-fmt/dart_fmt
v0.1.2
Published
Dart Formatter powered by WASM ported from dart_style
Downloads
80
Readme
Install
npm install @wasm-fmt/dart_fmt
npx jsr add @fmt/dart-fmt
Usage
import init, { format } from "@wasm-fmt/dart_fmt";
await init();
const input = `void main() { print('Hello, World!'); }`;
const formatted = format(input, "main.dart");
console.log(formatted);
For Vite users:
Add "@wasm-fmt/dart_fmt"
to optimizeDeps.exclude
in your vite config:
{
"optimizeDeps": {
"exclude": ["@wasm-fmt/dart_fmt"]
}
}
import init, { format } from "@wasm-fmt/dart_fmt/vite";
// ...