verovio_flutter 0.1.1
verovio_flutter: ^0.1.1 copied to clipboard
Flutter FFI plugin for Verovio music notation rendering.
verovio_flutter #
Render beautiful sheet music in your Flutter app — from MEI, MusicXML, ABC, Humdrum or PAE, straight to SVG.
Language: English | 中文
[Chopin — Mazurka in F-sharp Minor, Op.6 No.1, engraved by verovio_flutter]
Chopin — Mazurka Op.6 No.1, rendered by verovio_flutter from MEI source.
verovio_flutter is a Flutter FFI plugin that embeds Verovio — the open-source music notation engraving library used by the MEI community, RISM, and the Music Encoding Initiative — directly into your Android and iOS apps. No server, no WebView, no network. Just native engraving on device.
Why use it #
- Real engraving, not just rendering — Verovio lays out music with publication quality (beams, slurs, ties, articulations, lyrics, multi-voice, page breaks).
- Works offline — everything runs natively on the device via FFI. No HTTP, no JS bridge.
- Multiple input formats — MEI, MusicXML, Humdrum, ABC, Plaine & Easie.
- SVG output — vector graphics that scale on any screen, embed in your own widgets, export to PDF, or post-process freely.
- Isolate-friendly —
VerovioService.spawnruns on a worker isolate so rendering never blocks your UI. - Drop-in size — ~7 MB per ABI after
--split-per-abion Android.
Install #
dependencies:
verovio_flutter: ^0.1.1
Quick start #
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:verovio_flutter/verovio_flutter.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// 1. Unpack the Verovio font/data assets once.
final resourcePath = await VerovioResourceManager.ensureVerovioAssetsReady();
// 2. Spawn an engraving isolate.
final service = await VerovioService.spawn(resourcePath: resourcePath);
// 3. Feed it MEI / MusicXML / ABC / Humdrum.
service.loadData('''<mei xmlns="http://www.music-encoding.org/ns/mei">
<music><body><mdiv><score><section/></score></mdiv></body></music>
</mei>''');
// 4. Get an SVG string for any page and draw it.
final svg = service.renderToSvg(1);
runApp(MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('verovio_flutter')),
body: SvgPicture.string(svg),
),
));
}
A complete runnable example lives in example/.
Gallery #
All images below are produced by Verovio on-device from MEI sources — what you see is what your users will see.
| Vocal score with lyrics | Virtuosic piano writing |
|---|---|
| [Mozart — Das Veilchen] | [Debussy — Golliwogg's Cakewalk] |
| Mozart — Das Veilchen, K.476 | Debussy — Golliwogg's Cakewalk |
Platform support #
| Platform | Minimum version | Architectures |
|---|---|---|
| Android | API 21 | arm64-v8a / x86_64 |
| iOS | 13.0 | arm64 (device) / arm64 + x86_64 (simulator) |
Size #
| Component | Size |
|---|---|
android/src/main/jniLibs |
14 MB |
ios/Frameworks/VerovioFFI.xcframework |
8.6 MB |
assets/verovio_data (fonts + schemas) |
11 MB |
| Bundled total | 33.6 MB |
Per-ABI install footprint on Android with --split-per-abi: ~6.8 MB (arm64-v8a) / ~7.2 MB (x86_64) before APK compression.
API reference #
See doc/api.md for the full VerovioService surface (options, page navigation, MIDI export, time-map, etc.).
Version mapping #
| verovio_flutter | Verovio upstream |
|---|---|
| 0.1.0 | version-2.7.1-10372-g8100cb396 (8100cb39604d40102a9c2ce75719136f3fb52a77) |
| 0.1.1 | version-6.2.1 (8d42439dc9231f6c87779287b542febcb3d609b3) |
License #
LGPL-3.0. Verovio is LGPL-3.0; any derivative work must comply with the same obligations. You can use this plugin in closed-source apps as long as you respect the LGPL dynamic-linking rules.
Maintainer guide #
Build and sync commands
- Clone with submodules:
git clone --recurse-submodules https://github.com/csa8820/verovio_flutter - Rebuild Android
.so:bash tool/build_android_so.sh - Rebuild iOS
.xcframework:bash tool/build_ios_xcframework.sh - Sync upstream Verovio sources:
bash tool/sync_verovio_sources.sh - GitHub Actions CI runs Android + iOS build validation on PRs and pushes to
main.
Credits #
Built on top of Verovio by the RISM Digital Center. This plugin only provides the Flutter / FFI glue — all the engraving magic is theirs.