MethodChannelFlutterLive2d class
Default platform implementation of FlutterLive2dPlatform, routing every
call through the flutter_live2d MethodChannel.
Behavioral notes that apply across calls:
viewIdidentifies the native view created when aLive2DViewwidget mounts. The native side uses it to look up the per-view state (model, GL surface, …) and returns aVIEW_NOT_FOUNDerror if the view has already been disposed.- Native errors are surfaced as PlatformExceptions with the codes listed in the Live2DException documentation. The Dart-side Live2DViewController normalizes them into Live2DException.
- Inheritance
-
- Object
- PlatformInterface
- FlutterLive2dPlatform
- MethodChannelFlutterLive2d
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- methodChannel → MethodChannel
-
Underlying MethodChannel. Exposed for tests so they can install a
mock handler; treat it as private otherwise.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getPlatformVersion(
) → Future< String?> -
Returns the host platform's version string (e.g.
"Android 14"). Used as a smoke test that the channel is wired up.override -
loadModel(
{required int viewId, required String modelDir, required String modelFileName}) → Future< bool> -
Loads a Live2D model into the native view identified by
viewId.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setExpression(
{required int viewId, required int index}) → Future< void> -
Switches the active expression on
viewIdto the one atindexin the model's expression list (0-based).override -
setMotionSpeed(
{required int viewId, required double speed}) → Future< void> -
Sets the motion playback speed multiplier for
viewId.override -
setParameter(
{required int viewId, required String parameterId, required double value}) → Future< void> -
Sets the model parameter
parameterIdonviewIdtovalue.override -
setRenderingPaused(
{required int viewId, required bool paused}) → Future< void> -
Pauses or resumes the GL render loop for
viewId.override -
startMotion(
{required int viewId, required String group, required int index, int priority = 2}) → Future< void> -
Plays a motion on
viewId.override -
toString(
) → String -
A string representation of this object.
inherited
-
unloadModel(
{required int viewId}) → Future< void> -
Unloads the model currently bound to
viewIdand frees its native resources. No-op if no model is loaded.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited