ssplayer_flutter 7.0.0-beta.1
ssplayer_flutter: ^7.0.0-beta.1 copied to clipboard
SpriteStudio Player for Flutter: plays SpriteStudio animations (.ssab) as a Flutter widget, on the Rust runtime every official SpriteStudio Player shares.
ssplayer_flutter #
Play SpriteStudio raster animations (.ssab) natively in Flutter —
rigged by an artist in a dedicated editor, drawn straight to the Flutter
Canvas, with no animation code to hand-write.
This is the package most apps depend on: a widget and a controller that play a
.ssab, over the runtime in ssruntime_dart.
The native runtime arrives through Dart native assets — no CocoaPods, no
framework to embed, no DynamicLibrary path, and no Rust toolchain.
Install #
flutter pub add ssplayer_flutter
ssruntime_dart comes with it (Installation).
Needs Flutter 3.47+ / Dart 3.13+ — native assets is stable and default-on, and the
flutter_gpu backend needs the GPU API that landed in 3.47.
Use #
import 'package:ssplayer_flutter/ssplayer_flutter.dart';
SpriteStudioAnimation.asset(
'assets/spritestudio/Ringo/Ringo.ssab',
animation: 'wait1',
width: 400,
height: 400,
)
List the pack's folder under flutter: assets: in pubspec.yaml. The widget
reads the bytes from the asset bundle, resolves sibling reference textures
from the key's own folder (embedded packs too), plays animation: — the pack's
first animation without it — loops it, and disposes everything with the widget.
placeholder: is what to show until the first frame is drawable; onError:
hears about a load that failed.
Owning the player #
SpriteStudioAnimation builds a player because most screens do not want one.
When yours does — swapping animations from a state machine, subscribing to
events, sticking a widget to a part, or driving the clock yourself — build a
SpriteStudioPlayer and hand it to SpriteStudioView, which is a plain
RenderBox you position, transform and clip like any other widget:
class _MyState extends State<MyWidget> with SingleTickerProviderStateMixin {
late final SpriteStudioPlayer _player = SpriteStudioPlayer(vsync: this);
@override
void initState() {
super.initState();
_init();
}
Future<void> _init() async {
await _player.loadAsset('assets/spritestudio/Ringo/Ringo.ssab');
if (!mounted) return;
_player
..setAnimation('wait1')
..loopCount = -1
..play();
}
@override
void dispose() { _player.dispose(); super.dispose(); }
@override
Widget build(BuildContext context) =>
SpriteStudioView(player: _player, width: 400, height: 400);
}
Notes #
vsyncis optional. With it the player owns aTicker; without it you drive the clock yourself throughadvance(dt)— which is how the Flame adapter (ssplayer_flame) hands the game loop's time to the same player.- A pack is either Reference or Embedded. Reference packs load sibling PNG /
WebP files from the asset key's own folder; embedded packs carry their
textures and need nothing else.
loadAssethandles both. - The
.sspj→.ssabconversion is a host-side step, not something the runtime does — seessconverter_dart. - Web is a developer preview. Call
await loadSsRuntime()once beforerunApp(a no-op on native).
More #
- Documentation — and the same pages for
this version, as Markdown, in this package's
doc/(start atdoc/index.md), readable offline, and as the Agent Skillskills/ssplayer-flutter-docs/, whichdart run skills@ get --allinstalls into your coding agent's skills directory (add--agent claude, or another agent, when the project has none yet) - Live Web demo — this API running in a browser
- What is and is not supported
- Repository · example app under
examples/overall