### Initialize and Teardown Systems (Dart) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md Initialize and Teardown systems handle setup and cleanup operations within the component system. InitializeSystem runs once when the system starts, and TeardownSystem runs once when the system is disposed. The DatabaseInitSystem and DatabaseTeardownSystem examples show how to manage database connections. ```dart class DatabaseInitSystem extends InitializeSystem { @override Set get interactsWith => {DatabaseComponent}; @override void initialize() { // Initialize database connection print('Database initialized'); } } class DatabaseTeardownSystem extends TeardownSystem { @override Set get interactsWith => {DatabaseComponent}; @override void teardown() { // Close database connection print('Database closed'); } } ``` -------------------------------- ### InitializeSystem - Setup Tasks Source: https://github.com/flameofudun/flutter_event_component_system/wiki/System Systems designed to perform setup tasks once after the first frame and before other systems execute. ```APIDOC ## InitializeSystem ### Description Systems that perform setup tasks before the main execution loop begins. They are called once after the first frame. ### Methods - `initialize()` – Override to implement initialization logic. ### Notes - Called **once after the first frame** and before other systems. ``` -------------------------------- ### Bash: Flutter Run Example Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md Navigates into the example directory and runs the example application. This is useful for testing features and understanding the project's usage. ```bash cd example flutter run ``` -------------------------------- ### Installation Rules for Windows Executable (CMake) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/inspector/windows/CMakeLists.txt Configures the installation process for the Windows build, setting the installation prefix to be adjacent to the executable. It installs the main executable, ICU data, Flutter library, bundled plugin libraries, and native assets. ```cmake # === Installation === # Support files are copied into place next to the executable, so that it can # run in place. This is done instead of making a separate bundle (as on Linux) # so that building and running from within Visual Studio will work. set(BUILD_BUNDLE_DIR "$") # Make the "install" step default, as it's required to run. set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installation Rules for Windows Executable and Assets Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/example/windows/CMakeLists.txt Configures the installation process for the Windows build. This includes setting the installation prefix to the executable's directory, installing the main executable, ICU data, Flutter library, bundled plugin libraries, native assets, and Flutter assets. It ensures assets are fully re-copied on each build. ```cmake set(BUILD_BUNDLE_DIR "$") set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Bash: Flutter Install Dependencies Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md Installs all the necessary project dependencies defined in the pubspec.yaml file using the Flutter package manager. This command should be run after cloning the repository. ```bash flutter pub get ``` -------------------------------- ### Install Application Components (CMake) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/tutorial/linux/CMakeLists.txt This CMake script handles the installation of the Flutter application components. It sets up the installation directory, installs the main executable, Flutter ICU data, the Flutter library, bundled plugin libraries, and native assets. It also manages the Flutter assets directory and optionally installs the AOT library for non-Debug builds. ```cmake # === Installation === # By default, "installing" just makes a relocatable bundle in the build # directory. set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() # Start with a clean build bundle directory every time. install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) # Install the AOT library on non-Debug builds only. if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### CMake Installation Rules for Windows Executable and Assets Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/benchmark/windows/CMakeLists.txt Defines installation rules for the Windows executable, runtime components, and assets. It sets up the installation prefix, copies the executable, ICU data, Flutter library, bundled plugin libraries, and native assets. It also handles the installation of Flutter assets and the AOT library for Profile and Release builds. ```cmake # === Installation === # Support files are copied into place next to the executable, so that it can # run in place. This is done instead of making a separate bundle (as on Linux) # so that building and running from within Visual Studio will work. set(BUILD_BUNDLE_DIR "$") # Make the "install" step default, as it's required to run. set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) # Install the AOT library on non-Debug builds only. install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Setup ECS Scope in Flutter Application Source: https://context7.com/flameofudun/flutter_event_component_system/llms.txt Illustrates how to integrate the ECS with the Flutter application lifecycle using ECSScope. This example shows setting up a main scope with multiple features and demonstrates creating nested scopes for isolated feature sets. ```dart import 'package:flutter/material.dart'; import 'package:flutter_event_component_system/flutter_event_component_system.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); runApp(MyApp()); } class MyApp extends StatelessWidget { final navigatorKey = GlobalKey(); @override Widget build(BuildContext context) { return ECSScope( name: "Main", // Optional name for debugging features: { CounterFeature(), UserAuthFeature(), TimerFeature(), NavigationFeature(navigatorKey: navigatorKey), }, child: MaterialApp( navigatorKey: navigatorKey, home: HomePage(), routes: { '/': (context) => HomePage(), '/dashboard': (context) => DashboardPage(), '/login': (context) => LoginPage(), }, ), ); } } // Nested scopes for isolated feature sets class SubmoduleApp extends StatelessWidget { @override Widget build(BuildContext context) { return ECSScope( name: "Submodule", features: { SubmoduleFeature(), }, child: SubmodulePage(), ); } } ``` -------------------------------- ### Manual ECSManager Setup and Execution in Dart Source: https://context7.com/flameofudun/flutter_event_component_system/llms.txt Demonstrates manual setup, activation, initialization, entity access, event triggering, manual execution loop, and cleanup of the ECSManager. Useful for advanced control, testing, or custom loop management. ```dart import 'package:flutter_event_component_system/flutter_event_component_system.dart'; void manualSetupExample() { // Create manager with optional name final manager = ECSManager(name: 'TestManager'); // Add features manager.addFeature(CounterFeature()); manager.addFeatures({ TimerFeature(), UserAuthFeature(), }); // Activate manager (starts listening) manager.activate(); // Initialize all features manager.initialize(); // Access entities final counter = manager.getEntity(); final incrementEvent = manager.getEntity(); // Trigger events incrementEvent.trigger(); print('Counter value: ${counter.value}'); // Execute loop manually (for testing or custom control) final elapsed = Duration(milliseconds: 16); manager.execute(elapsed); manager.cleanup(); // Teardown and deactivate manager.teardown(); manager.deactivate(); } // Testing example void testExample() { final manager = ECSManager(); final feature = CounterFeature(); manager.addFeature(feature); manager.activate(); manager.initialize(); // Get entities final counter = manager.getEntity(); final increment = manager.getEntity(); // Test initial state assert(counter.value == 0); // Trigger event increment.trigger(); // Verify state changed assert(counter.value == 1); // Cleanup manager.teardown(); manager.deactivate(); } // Accessing manager from scope void widgetManagerAccess(BuildContext context) { // Get manager from nearest ECSScope final manager = ECSScope.of(context); // Check if scope exists final maybeManager = ECSScope.maybeOf(context); if (maybeManager != null) { // Use manager } } ``` -------------------------------- ### Organize ECS Architecture into Features in Dart Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md This example shows how to group related components, events, and systems into a cohesive `ECSFeature`. This modular approach helps in organizing the application's state and logic, making it more maintainable and scalable. ```dart class CounterFeature extends ECSFeature { CounterFeature() { // Add components addEntity(CounterComponent()); addEntity(IncrementEvent()); // Add systems addSystem(IncrementCounterSystem()); } } ``` -------------------------------- ### Setup ECS Scope in Flutter Dart Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md This snippet demonstrates how to initialize the ECS framework by providing a set of features within an `ECSScope` widget. This makes the ECS context available to descendant widgets in the Flutter application tree. ```dart class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return ECSScope( features: { CounterFeature(), }, child: MaterialApp( home: CounterPage(), ), ); } } ``` -------------------------------- ### Asset and AOT Library Installation (CMake) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/inspector/windows/CMakeLists.txt Handles the installation of Flutter assets and the Ahead-Of-Time (AOT) compiled library. Assets are copied after ensuring the destination directory is clean, and the AOT library is installed only for Profile and Release configurations. ```cmake # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) # Install the AOT library on non-Debug builds only. install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Organize User Authentication Feature in Dart Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md This example illustrates how to structure a `UserAuthFeature` by adding relevant components (like `AuthStateComponent`, `LoginCredentialsComponent`) and events (like `LoginEvent`, `LogoutEvent`), along with their associated reactive systems. ```dart class UserAuthFeature extends ECSFeature { UserAuthFeature() { // Components addEntity(AuthStateComponent()); addEntity(LoginCredentialsComponent()); // Events addEntity(LoginEvent()); addEntity(LogoutEvent()); // Systems addSystem(LoginUserReactiveSystem()); addSystem(LogoutUserReactiveSystem()); } } ``` -------------------------------- ### Create Reactive Widgets in Flutter Dart Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md This code defines a Flutter widget that integrates with the ECS, using `ECSWidget` and `ECSContext`. It demonstrates how to access and 'watch' components for reactive updates and get event instances to trigger actions. ```dart class CounterPage extends ECSWidget { @override Widget build(BuildContext context, ECSContext ecs) { final counter = ecs.watch(); final incrementEvent = ecs.get(); return Scaffold( appBar: AppBar(title: Text('Counter')), body: Center( child: Text('Count: ${counter.value}'), ), floatingActionButton: FloatingActionButton( onPressed: incrementEvent.trigger, child: Icon(Icons.add), ), ); } } ``` -------------------------------- ### Reactive System for Component Updates (Dart) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md Reactive Systems in this framework automatically respond to changes in specified components. The ValidationSystem example shows how to define which components trigger the system (reactsTo) and which components it modifies (interactsWith). The reactsIf property allows for conditional activation of the system. ```dart class ValidationSystem extends ReactiveSystem { ValidationSystem(); @override Set get reactsTo => {FormDataComponent}; @override Set get interactsWith => {ValidationStateComponent}; @override bool get reactsIf => true; // Conditional reactions @override void react() { final formData = getEntity(); final validation = getEntity(); // Validate form data final isValid = validateForm(formData.value); validation.update(isValid); } } ``` -------------------------------- ### Component Design Best Practice in Dart Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md This Dart code example demonstrates a best practice for ECS component design, emphasizing the use of immutable data structures. The `UserComponent` uses a `copyWith` method to create a new state with the updated name, ensuring immutability and predictable state changes. ```dart // ✅ Good: Immutable data structures class UserComponent extends ECSComponent { UserComponent(super.value); void updateName(String name) { update(value.copyWith(name: name)); } } // ❌ Avoid: Mutable data class UserComponent extends ECSComponent { UserComponent(super.value); void updateName(String name) { value.name = name; // Don't mutate directly notifyListeners(); // Manual notification } } ``` -------------------------------- ### Lifecycle Systems: Initialization, Cleanup, and Teardown Source: https://context7.com/flameofudun/flutter_event_component_system/llms.txt Lifecycle systems manage the setup and teardown of features or components within the Flutter Event Component System. Initialize systems run once on feature startup, Cleanup systems run after each frame to clear temporary data, and Teardown systems run once on feature disposal to perform final cleanup operations like closing connections. ```dart import 'package:flutter_event_component_system/flutter_event_component_system.dart'; // Initialize system - runs once on feature startup class StartTimerInitializeSystem extends InitializeSystem { @override Set get interactsWith => {TimerStateComponent}; @override void initialize() { final state = getEntity(); state.update(TimerState.stopped); log('Timer initialized', level: ECSLogLevel.info); } } // Cleanup system - runs after each frame class FrameCleanupSystem extends CleanupSystem { @override Set get interactsWith => {TemporaryDataComponent}; @override bool get cleansIf { final data = getEntity(); return data.value.shouldClean; } @override void cleanup() { final data = getEntity(); data.update(data.value.cleared()); } } // Teardown system - runs once on feature disposal class DatabaseTeardownSystem extends TeardownSystem { @override Set get interactsWith => {DatabaseComponent}; @override void teardown() { final db = getEntity(); db.value.close(); log('Database connection closed', level: ECSLogLevel.info); } } ``` -------------------------------- ### Execute System for Continuous Execution (Dart) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md Execute Systems run continuously on each frame, making them suitable for time-based updates or ongoing processes. The TimerSystem example demonstrates an ExecuteSystem that updates a TimerComponent each frame. The executesIf property controls whether the system is active, and the execute method receives the elapsed time since the last frame. ```dart class TimerSystem extends ExecuteSystem { TimerSystem(); @override Set get interactsWith => {TimerComponent}; @override executesIf => true; // Conditional executions @override void execute(Duration elapsed) { final timer = getEntity(); timer.update(timer.value + elapsed.inMilliseconds); } } ``` -------------------------------- ### Bash: Git Clone Repository Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md Clones the flutter_event_component_system repository from GitHub and navigates into the project directory. This is the initial step for setting up the project locally. ```bash git clone https://github.com/FlameOfUdun/flutter_event_component_system.git cd flutter_event_component_system ``` -------------------------------- ### Define and Trigger Events in Dart Source: https://context7.com/flameofudun/flutter_event_component_system/llms.txt This snippet shows how to define custom events that can be triggered to communicate actions across the ECS system. It includes examples of defining various event types like Login, Logout, Increment, and Timer events. The usage example demonstrates how to obtain an event instance from an `ECSManager` and trigger it, noting that events automatically log their triggers. ```dart import 'package:flutter_event_component_system/flutter_event_component_system.dart'; // Define events for user actions class LoginEvent extends ECSEvent { LoginEvent(); } class LogoutEvent extends ECSEvent { LogoutEvent(); } class IncrementEvent extends ECSEvent { IncrementEvent(); } class TimerStartEvent extends ECSEvent { TimerStartEvent(); } class TimerStopEvent extends ECSEvent { TimerStopEvent(); } // Usage: triggering events void example(ECSManager manager) { // Get event from manager final loginEvent = manager.getEntity(); // Trigger the event (notifies all listeners) loginEvent.trigger(); // Check when event was last triggered print('Login triggered at: ${loginEvent.triggeredAt}'); // Events automatically log when triggered final incrementEvent = manager.getEntity(); incrementEvent.trigger(); // Logs: "IncrementEvent triggered" } ``` -------------------------------- ### Find and Check GTK, GLIB, and GIO Packages Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/tutorial/linux/flutter/CMakeLists.txt This section uses PkgConfig to find and check for the presence of GTK, GLIB, and GIO development libraries. These are system-level dependencies required for the Flutter Linux GTK backend. If any of these packages are not found, the build will fail. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) ``` -------------------------------- ### ReactiveSystem - Reacting to Entity Changes Source: https://github.com/flameofudun/flutter_event_component_system/wiki/System Systems designed to react to specific entity changes, optimizing performance by tracking relevant entities. ```APIDOC ## ReactiveSystem ### Description Systems that react to entity changes, such as component updates or event triggers. They are event-driven and can be optimized by specifying reaction criteria. ### Properties - `reactsTo` (Set) – The set of entity types this system reacts to (event triggers or component updates). - `reactsIf` (bool) – Whether the system reacts when an entity changes. ### Methods - `react()` – Override to implement reaction logic. ### Notes - Reactive systems are **event-driven**. - Optimize by specifying `reactsTo` to only track relevant entities and `reactsIf`. ``` -------------------------------- ### Handle Component Changes with Event Listeners Source: https://context7.com/flameofudun/flutter_event_component_system/llms.txt Shows how to use `ecs.listen()` to react to component changes and trigger side effects. Examples include displaying snackbars based on error or success components, and handling navigation events. ```dart import 'package:flutter/material.dart'; import 'package:flutter_event_component_system/flutter_event_component_system.dart'; // Widget with event listeners class NotificationWidget extends ECSWidget { const NotificationWidget({super.key}); @override Widget build(BuildContext context, ECSContext ecs) { // Listen to error component for showing snackbars ecs.listen((entity) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text(entity.value.message), backgroundColor: Colors.red, ), ); }); // Listen to success notifications ecs.listen((entity) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text(entity.value), backgroundColor: Colors.green, ), ); }); return Container(); // Your widget content } } // Multiple listeners for navigation class NavigationListener extends ECSWidget { const NavigationListener({super.key}); @override Widget build(BuildContext context, ECSContext ecs) { ecs.listen((entity) { Navigator.of(context).pushNamed(entity.value); }); ecs.listen((entity) { Navigator.of(context).pop(); }); return YourWidget(); } } ``` -------------------------------- ### Bash: Flutter Run Tests Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md Executes all the unit and widget tests defined within the project. This command is crucial for ensuring the project's stability and correctness. ```bash flutter test ``` -------------------------------- ### Feature Organization Best Practice in Dart Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md This Dart code snippet illustrates the recommended way to organize features within a Flutter ECS project. It shows a clear separation of concerns by grouping components, events, and systems for a specific feature (e.g., `user_auth_feature`) into its own directory. ```dart // ✅ Good: Organized by domain features/ user_auth_feature/ components/ events/ systems/ user_auth_feature.dart // ❌ Avoid: Mixing concerns features/ all_components.dart all_events.dart all_systems.dart ``` -------------------------------- ### Flutter Tool Backend Custom Command (CMake) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/tutorial/windows/flutter/CMakeLists.txt This CMake snippet defines a custom command to invoke the Flutter tool backend. It uses a phony target to ensure the command runs every time, passing necessary environment variables and platform configurations. The output of this command includes the Flutter library, headers, and wrapper source files, which are then used by the 'flutter_assemble' target. ```cmake # _phony_ is a non-existent file to force this command to run every time, # since currently there's no way to get a full input/output list from the # flutter tool. set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ${PHONY_OUTPUT} COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### CleanupSystem - Post-Execution Tasks Source: https://github.com/flameofudun/flutter_event_component_system/wiki/System Systems that perform cleanup tasks after the main execution phase and before the next frame begins. ```APIDOC ## CleanupSystem ### Description Systems that perform cleanup tasks after the main execution phase and before the next frame starts. They are executed after `ExecuteSystem`s. ### Properties - `cleansIf` (bool) – Determines whether cleanup should be executed on this frame. ### Methods - `cleanup()` – Override to implement cleanup logic. ### Notes - Executed after all `ExecuteSystem`s and before the next frame. ``` -------------------------------- ### Define Flutter and System Dependencies (CMake) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/tutorial/linux/CMakeLists.txt This CMake script defines rules for building Flutter libraries and tools, finds necessary system packages like PkgConfig and GTK, and adds subdirectories for the application runner and Flutter's generated plugins. ```cmake # Flutter library and tool build rules. set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) # System-level dependencies. find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) # Application build; see runner/CMakeLists.txt. add_subdirectory("runner") # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) # Only the install-generated bundle's copy of the executable will launch # correctly, since the resources must in the right relative locations. To avoid # people trying to run the unbundled copy, put it in a subdirectory instead of # the default top-level location. set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) # Generated plugin build rules, which manage building the plugins and adding # them to the application. include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Configure Flutter Library and Headers Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/inspector/windows/flutter/CMakeLists.txt Defines the Flutter library path, ICU data file, and project build directory. It also lists and prepends the Flutter library headers with the ephemeral directory. This configuration is essential for linking the Flutter engine into the application. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Project and Build Configuration (CMake) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/inspector/windows/CMakeLists.txt Defines the project, minimum CMake version, executable name, and handles multi-configuration generator settings. It sets up build types like Debug, Profile, and Release, ensuring compatibility with different CMake versions and generators. ```cmake cmake_minimum_required(VERSION 3.14) project(flutter_event_component_system_inspector LANGUAGES CXX) set(BINARY_NAME "flutter_event_component_system_inspector") cmake_policy(VERSION 3.14...3.25) get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) else() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() endif() ``` -------------------------------- ### ECSSystem - Base System Class Source: https://github.com/flameofudun/flutter_event_component_system/wiki/System The base class for all ECS systems, providing fundamental properties and protected methods for logging and entity retrieval. ```APIDOC ## ECSSystem ### Description The base class for all ECS systems. It provides fundamental properties and methods for interacting with entities and managing logs. ### Properties - `interactsWith` (Set) - The set of entity types this system will interact with (trigger events or update components). ### Methods - `log(String message, {ECSLogLevel level})` (protected) – Log messages via the feature’s manager. - `getEntity()` (protected) – Retrieve an entity of a specific type, checking cache, feature, and manager in order. ``` -------------------------------- ### Build Flutter C++ Wrapper for Plugins Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/inspector/windows/flutter/CMakeLists.txt Compiles C++ wrapper sources for Flutter plugins as a static library. It includes core implementation files and plugin-specific registrar files. This library facilitates plugin communication with the Flutter engine. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_PLUGIN "plugin_registrar.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") # Wrapper sources needed for a plugin. add_library(flutter_wrapper_plugin STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ) apply_standard_settings(flutter_wrapper_plugin) set_target_properties(flutter_wrapper_plugin PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(flutter_wrapper_plugin PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) target_include_directories(flutter_wrapper_plugin PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_plugin flutter_assemble) ``` -------------------------------- ### Create Reactive Systems in Dart Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md This code illustrates the creation of a `ReactiveSystem` that responds to specific events and interacts with components. The `react` method contains the logic executed when an `IncrementEvent` is triggered, updating the `CounterComponent`. ```dart // Systems define behavior and reactions class IncrementCounterSystem extends ReactiveSystem { IncrementCounterSystem(); @override Set get reactsTo => {IncrementEvent}; @override Set get interactsWith => {CounterComponent}; @override void react() { final counter = getEntity(); counter.update(counter.value + 1); } } ``` -------------------------------- ### List Prepend Function for CMake (Version < 3.10) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/tutorial/linux/flutter/CMakeLists.txt This CMake function prepends a prefix to each element in a given list. It's a workaround for the `list(TRANSFORM ... PREPEND ...)` command which is not available in CMake version 3.10. It takes the list name and the prefix as arguments and modifies the list in place. ```cmake function(list_prepend LIST_NAME PREFIX) set(NEW_LIST "") foreach(element ${${LIST_NAME}}) list(APPEND NEW_LIST "${PREFIX}${element}") endforeach(element) set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) endfunction() ``` -------------------------------- ### Dart: System Granularity in ECS Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/README.md Demonstrates good practice of single responsibility for systems in an ECS pattern, contrasting with systems that handle multiple responsibilities. This ensures maintainability and testability of individual system components. ```dart class ValidateEmailSystem extends ReactiveSystem { @override Set get reactsTo => {EmailComponent}; @override void react() { // Only validate email } } class ValidatePasswordSystem extends ReactiveSystem { @override Set get reactsTo => {PasswordComponent}; @override void react() { // Only validate password } } class ValidateEverythingSystem extends ReactiveSystem { @override void react() { // Validate email, password, phone, etc. } } ``` -------------------------------- ### CMake Configuration for Flutter Wrapper Plugin Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/benchmark/windows/flutter/CMakeLists.txt Defines and configures the static library for the Flutter wrapper plugin. This includes core and plugin-specific C++ sources, visibility settings, and linking against the Flutter library. ```cmake # === Wrapper === list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_PLUGIN "plugin_registrar.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") # Wrapper sources needed for a plugin. add_library(flutter_wrapper_plugin STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ) apply_standard_settings(flutter_wrapper_plugin) set_target_properties(flutter_wrapper_plugin PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(flutter_wrapper_plugin PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) target_include_directories(flutter_wrapper_plugin PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_plugin flutter_assemble) ``` -------------------------------- ### Link Dependencies and Include Directories (CMake) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/benchmark/windows/runner/CMakeLists.txt Specifies the libraries and include directories required for the application build. This includes Flutter-specific libraries, wrapper libraries, and system libraries like dwmapi.lib, as well as the project's source directory. ```cmake # Add dependency libraries and include directories. Add any application-specific # dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### Apply Standard Build Settings (CMake) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/benchmark/windows/runner/CMakeLists.txt Applies a standard set of build settings to the application target. This simplifies the build configuration for typical Flutter applications and can be customized if the project requires specific build behaviors. ```cmake # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Configure Flutter Application Build (CMake) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/example/windows/runner/CMakeLists.txt Sets up the CMake build system for a Flutter application, defining the main executable, linking necessary libraries, and including Flutter-specific build targets. This configuration is essential for compiling and linking the native components of the Flutter application on Windows. ```cmake cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) # Define the application target. To change its name, change BINARY_NAME in the # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer # work. # # Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} WIN32 "flutter_window.cpp" "main.cpp" "utils.cpp" "win32_window.cpp" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" "Runner.rc" "runner.exe.manifest" ) # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) # Add preprocessor definitions for the build version. target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"" target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") # Disable Windows macros that collide with C++ standard library functions. target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") # Add dependency libraries and include directories. Add any application-specific # dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Build Flutter C++ Wrapper for Application Runner Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/inspector/windows/flutter/CMakeLists.txt Compiles C++ wrapper sources for the Flutter application runner as a static library. It includes core implementation files and application-specific engine and view controller files. This library is used by the main application to host the Flutter engine. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") # Wrapper sources needed for the runner. add_library(flutter_wrapper_app STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_APP} ) apply_standard_settings(flutter_wrapper_app) target_link_libraries(flutter_wrapper_app PUBLIC flutter) target_include_directories(flutter_wrapper_app PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_app flutter_assemble) ``` -------------------------------- ### CMake: Configure Flutter Library and Headers Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/example/windows/flutter/CMakeLists.txt This CMake code configures the Flutter library and its associated headers. It sets up include directories and links against the Flutter library, ensuring that the Flutter engine's headers are accessible. ```cmake cmake_minimum_required(VERSION 3.14) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") # Configuration provided via flutter tool. include(${EPHEMERAL_DIR}/generated_config.cmake) # TODO: Move the rest of this into files in ephemeral. See # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") # Set fallback configurations for older versions of the flutter tool. if (NOT DEFINED FLUTTER_TARGET_PLATFORM) set(FLUTTER_TARGET_PLATFORM "windows-x64") endif() # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Build Reactive Widgets with ECSBuilder in Dart Source: https://context7.com/flameofudun/flutter_event_component_system/llms.txt Demonstrates how to use ECSBuilder to create functional, reactive widgets that automatically rebuild when specific components change. This is useful for displaying simple state or integrating with the ECS context in a stateless manner. It requires the 'flutter_event_component_system' package. ```dart import 'package:flutter/material.dart'; import 'package:flutter_event_component_system/flutter_event_component_system.dart'; // Simple functional widget Widget buildCounterDisplay() { return ECSBuilder( builder: (context, ecs) { final counter = ecs.watch(); return Text('Count: ${counter.value}'); }, ); } // Inline usage in widget tree class DashboardPage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Dashboard')), body: Column( children: [ ECSBuilder( builder: (context, ecs) { final user = ecs.watch(); return Text('Welcome ${user.value.name}'); }, ), ECSBuilder( builder: (context, ecs) { final timer = ecs.watch(); return Text('Timer: ${timer.value.inSeconds}s'); }, ), ], ), ); } } ``` -------------------------------- ### Configure Build Type and System Root (CMake) Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/tutorial/linux/CMakeLists.txt This CMake script configures the build type (Debug, Profile, Release) if not already set and defines the system root path for cross-compilation environments. It sets specific modes for finding root paths based on whether it's for programs, packages, libraries, or includes. ```cmake # Root filesystem for cross-building. if(FLUTTER_TARGET_PLATFORM_SYSROOT) set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() # Define build configuration options. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() ``` -------------------------------- ### CMake Configuration for Flutter Runner Wrapper Source: https://github.com/flameofudun/flutter_event_component_system/blob/main/benchmark/windows/flutter/CMakeLists.txt Defines and configures the static library for the Flutter runner application wrapper. It includes core and application-specific C++ sources and links against the Flutter library. ```cmake # Wrapper sources needed for the runner. add_library(flutter_wrapper_app STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_APP} ) apply_standard_settings(flutter_wrapper_app) target_link_libraries(flutter_wrapper_app PUBLIC flutter) target_include_directories(flutter_wrapper_app PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_app flutter_assemble) ```