Skip to content

Dart Formatter powered by WASM ported from dart_style

License

Notifications You must be signed in to change notification settings

wasm-fmt/dart_fmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Dec 10, 2024
e557fca · Dec 10, 2024

History

37 Commits
Nov 17, 2024
Mar 12, 2024
Mar 11, 2024
Dec 10, 2024
Dec 10, 2024
Nov 17, 2024
Aug 9, 2024
Nov 17, 2024
Dec 10, 2024
Nov 17, 2024
Nov 17, 2024
Mar 11, 2024
Mar 11, 2024
May 15, 2024
Dec 10, 2024
Mar 11, 2024
Mar 11, 2024
Aug 11, 2024
Mar 11, 2024
Dec 10, 2024
Dec 10, 2024

Repository files navigation

Test

Install

npm

npm install @wasm-fmt/dart_fmt

jsr.io

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"]
    }
}
If you cannot change the vite config, you can use another import entry
import init, { format } from "@wasm-fmt/dart_fmt/vite";

// ...