flutter-embedded-linux

repository·master·Indexed 23 days ago

https://github.com/sony/flutter-embedded-linux

A non-official Flutter embedding optimized for embedded Linux (eLinux) systems. It focuses on lightweight performance and direct hardware access via DRM (GBM and EGLStream) and Wayland, avoiding heavy dependencies like X11 or GTK. It supports x64 and Arm64 architectures and provides examples for external texture plugins, video playback via GStreamer, and various display backends.

Tokens
5.5K
Snippets
16
Records
32
Agent score
77%

What's inside flutter-embedded-linux

  1. Overview of RapidJSON features and APIs

    master

    RapidJSON is a high-performance C++ JSON parser and generator. It provides two distinct API styles:

    1. DOM (Document Object Model) API: Parses JSON into a memory-resident tree structure. Best for when you need to navigate, modify, or access JSON data multiple times.
    2. SAX (Simple API for XML) API: A stream-based parser that triggers events as it reads the JSON. It is extremely fast and memory-efficient (the SAX parser is ~500 lines of code) because it doesn't build a full tree in memory.

    Key Characteristics

    • Fast: Performance is comparable to strlen(); supports SSE2/SSE4.2 acceleration.
    • Memory-friendly: Most 32/64-bit machines use exactly 16 bytes per Value (excluding text strings).
    • Self-contained: Header-only; no dependencies on BOOST or STL.
    • Unicode-friendly: Supports UTF-8, UTF-16, and UTF-32, including transcoding and validation.
    • Compliance: Fully compliant with RFC7159/ECMA-404, with optional support for relaxed syntax (comments, trailing commas, NaN/Infinity).
  2. Overview of flutter-embedded-linux

    master

    The flutter-embedded-linux project provides a non-official embedding for Flutter specifically optimized for Embedded Linux (eLinux) use cases. Unlike the standard Flutter desktop for Linux, this embedder is designed to be lightweight by avoiding dependencies on X11 and GTK, focusing instead on minimal library requirements and direct hardware interaction.

    Key characteristics include:

    • Target Architecture: Primarily optimized for Arm64 devices (support for Arm 32bit/ARMv7 is unconfirmed).
    • Display Backends: Supports Wayland and DRM (Direct Rendering Manager).
    • DRM Specifics: Supports GBM (Generic Buffer Management) and EGLStream for NVIDIA devices.
    • Windowing: Defaults to a single window fullscreen mode. Flexible sizing is only available when using Wayland or X11 backends.
    • Input Support: Supports keyboard, mouse, and touch inputs.
    • API Compatibility: Maintains compatibility with Flutter desktop for Windows and GLFW, including MethodChannel and EventChannel APIs.
  3. Overview of RapidJSON APIs

    master

    RapidJSON provides two primary styles of interaction:

    1. DOM API: Loads the entire JSON structure into memory as a tree. Best for when you need to navigate, modify, or access JSON data non-linearly.
    2. SAX API: A stream-based parser that triggers events as it encounters JSON elements. It is extremely memory-efficient and fast, ideal for processing large JSON files where you only need specific data points.

    Additional specialized APIs include:

    • Schema API: Uses JSON Schema to validate JSON during parsing or generation.
    • JSON Pointer: Provides a way to easily access and change specific parts of the DOM using path-like syntax.
  4. Build RapidJSON from source (Tests and Documentation)

    master

    To generate user documentation or run the built-in unit tests, follow these steps:

    1. Initialize submodules: git submodule update --init (required for googletest).
    2. Create a build directory: mkdir build && cd build.
    3. Configure with CMake: cmake ...
    4. Build:
      • On Linux: make
      • On Windows: Open the solution in the build directory using Visual Studio.

    To run tests after building:

    • Use make test or ctest.
    • For detailed output, use ctest -V.

    To install the library system-wide (requires administrative privileges):

    • Run make install from the build directory. Once installed, you can use find_package(RapidJSON) in your CMake-based projects.
  5. Explore backend-specific embedding examples

    master

    The repository provides several example applications demonstrating how to use different backends for Flutter on embedded Linux. Depending on your display server or hardware requirements, you can reference these specific implementations:

    • Wayland Client: flutter-wayland-client (for running as a Wayland client app).
    • DRM with GBM: flutter-drm-gbm-backend (for fullscreen applications using the DRM backend with GBM).
    • DRM with EGLStream: flutter-drm-eglstream-backend (for fullscreen applications using the DRM backend with EGLStream).
    • X11 Client: flutter-x11-client (for running as an X11 client app).
  6. Build the Flutter app bundle in debug mode

    master

    Before running the app, you need to build the Flutter asset bundle. This involves cloning the official Flutter plugins, building the video_player package bundle, and copying the icudtl.dat file from your Flutter SDK artifacts to the bundle directory.

    $ git clone https://github.com/flutter/plugins.git
    $ cd plugins/packages/video_player/video_player
    $ flutter build bundle --asset-dir=./bundle/data/flutter_assets
    $ cp <path_to_flutter_sdk_install>/bin/cache/artifacts/engine/linux-*/icudtl.dat ./bundle/data
  7. Build RapidJSON tests and examples

    master

    To build the test suite and examples provided in the repository, follow these steps:

    1. Initialize submodules to fetch dependencies like googletest:
      git submodule update --init
    2. Create a build directory inside the rapidjson directory.
    3. Run CMake to configure the project:
      cd rapidjson
      mkdir build
      cd build
      cmake ..
    4. Compile the project:
      • On Linux: Run make inside the build directory.
      • On Windows: Open the generated solution in the build directory using Visual Studio.

    After building, executables for tests and examples will be located in the bin directory. You can run tests using make test or ctest (use ctest -V for detailed output).

    git submodule update --init
    mkdir build && cd build
    cmake ..
    make
  8. Build the X11 client example application

    master

    To build the standalone X11 backend example application, use CMake. You must provide the USER_PROJECT_PATH definition pointing to the specific project directory (in this case, examples/flutter-x11-client) so the build system can locate the Flutter project source.

    $ mkdir build
    $ cd build
    $ cmake -DUSER_PROJECT_PATH=examples/flutter-x11-client ..
    $ cmake --build .
  9. Build the Wayland client example

    master

    To build the flutter-wayland-client example, which demonstrates a standalone application using the Wayland backend, use CMake. You must provide the USER_PROJECT_PATH flag pointing to the example directory so the build system can locate the Flutter project source.

    $ mkdir build
    $ cd build
    $ cmake -DUSER_PROJECT_PATH=examples/flutter-wayland-client ..
    $ cmake --build .
  10. Use the correct repositories for eLinux development

    master

    To develop Flutter applications for embedded Linux, you need to use a specific set of tools and repositories. The core embedding engine is separate from the Flutter SDK extensions used for building and debugging.