gameframework library

Flutter Game Framework

A modular, unified framework for embedding game engines (Unity, Unreal Engine, and potentially others) into Flutter applications.

Getting Started

  1. Initialize the engine plugin(s) you want to use:
void main() {
  UnityEnginePlugin.initialize(); // For Unity
  // UnrealEnginePlugin.initialize(); // For Unreal
  runApp(MyApp());
}
  1. Use the GameWidget to embed the engine:
GameWidget(
  engineType: GameEngineType.unity,
  onEngineCreated: (controller) {
    // Engine is ready, you can send messages
    controller.sendMessage('GameManager', 'Initialize', 'data');
  },
  onMessage: (message) {
    // Receive messages from the engine
    print('Engine says: ${message.data}');
  },
  config: GameEngineConfig(
    fullscreen: false,
    runImmediately: true,
  ),
)

Classes

GameEngineConfig
Configuration object for game engine initialization
GameEngineController
Abstract controller interface for all game engines
GameEngineEvent
Event representing a change in engine lifecycle
GameEngineFactory
Factory interface for creating engine controllers
GameEngineMessage
Base class for messages from the game engine
GameEngineRegistry
Registry for managing game engine implementations
GameSceneLoaded
Event fired when a scene/level is loaded in the engine
GameWidget
Main widget for embedding game engines in Flutter
PlatformDetails
Platform-specific details
PlatformInfo
Platform information utility for the game framework

Enums

AndroidPlatformViewMode
Android platform view rendering modes
GameEngineEventType
Lifecycle events from the game engine
GameEngineType
Enum representing supported game engines

Constants

gameFrameworkVersion → const String
Current version of the Flutter Game Framework

Typedefs

GameEngineCreatedCallback = void Function(GameEngineController controller)
Callback types
GameEngineMessageCallback = void Function(GameEngineMessage message)
GameEngineSceneLoadedCallback = void Function(GameSceneLoaded scene)
GameEngineUnloadCallback = void Function()

Exceptions / Errors

EngineCommunicationException
Exception for communication errors between Flutter and engine
EngineNotReadyException
Exception thrown when engine is not ready for operations
EngineNotRegisteredException
Exception thrown when engine plugin is not registered
EngineVersionException
Exception for engine version incompatibility
GameEngineException
Base exception for game framework errors
MultipleEnginesException
Exception thrown when trying to run multiple engines simultaneously