FlutterLive2dPlatform class abstract
Platform-specific implementation hook for flutter_live2d.
Federated plugin packages can subclass this and assign their instance to
instance to override how the Dart side talks to the native side. The
default implementation is MethodChannelFlutterLive2d, which routes
every call through the flutter_live2d method channel.
End users of the plugin should not interact with this class directly —
use Live2DViewController and Live2DView from flutter_live2d.dart.
- Inheritance
-
- Object
- PlatformInterface
- FlutterLive2dPlatform
- Implementers
Constructors
- FlutterLive2dPlatform()
-
Constructs a new platform interface, registering the verification token
used by
PlatformInterface.verifyToken.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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. -
loadModel(
{required int viewId, required String modelDir, required String modelFileName}) → Future< bool> -
Loads a Live2D model into the native view identified by
viewId. -
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). -
setMotionSpeed(
{required int viewId, required double speed}) → Future< void> -
Sets the motion playback speed multiplier for
viewId. -
setParameter(
{required int viewId, required String parameterId, required double value}) → Future< void> -
Sets the model parameter
parameterIdonviewIdtovalue. -
setRenderingPaused(
{required int viewId, required bool paused}) → Future< void> -
Pauses or resumes the GL render loop for
viewId. -
startMotion(
{required int viewId, required String group, required int index, int priority = 2}) → Future< void> -
Plays a motion on
viewId. -
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.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance ↔ FlutterLive2dPlatform
-
Returns the active platform implementation.
getter/setter pair