# citizenonex/frame_flutter_camera architecture

> Architecture diagram of the GitHub repository citizenonex/frame_flutter_camera, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/citizenonex/frame_flutter_camera
- Repository: https://github.com/citizenonex/frame_flutter_camera

## Overview

##### Project type and purpose
- This is a cross-platform mobile application written in Flutter (Dart) that acts as a host app and plugin to connect with a Frame camera device.
- Its primary purpose is to initiate photo captures on the Frame device, retrieve the captured images (along with exposure/gain settings), and display them in a scrollable list.

##### File structure
- Top‐level “android/” and “ios/” directories contain the native host and plugin implementations (Kotlin for Android, Swift/Obj-C bridging for iOS).
- “lib/main.dart” is the Flutter entry point and holds UI, state management, and MethodChannel calls.
- “assets/frame_app.lua” is a Lua script that is deployed to the Frame device to run capture logic.

##### README for additional insights
- The feature list (quality, metering, manual exposure/gain) indicates the UI offers controls whose values travel down to the device.

##### Capturing essential architectural elements
- UI widgets
- State/logic layer
- Platform interface
- Android vs. iOS code
- External Frame hardware
- Lua asset as a first-class element, since it’s the code running on the device.
- Configuration files or gradle/xcode projects only if they clarify build or deployment steps (optional).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Flutter Layer
    UI["Flutter UI & Business Logic"]:::flutter
    UI -->|"invokeMethod('capture',{quality,exposure})"| MC

    %% Platform Channel
    MC["MethodChannel"]:::channel
    MC -->|"routes call"| AND
    MC -->|"routes call"| IOS
    AND --> MC
    IOS --> MC
    MC --> UI

    %% Native Plugins
    subgraph "Native Plugins"
        AND["Android Plugin (Kotlin)"]:::native
        IOS["iOS Plugin (Swift)"]:::native
        BRI["Obj-C Bridging Header"]:::native
    end
    IOS --> BRI

    %% External Device & Asset
    LUA["Lua Script Asset"]:::external
    DEVICE["Frame Device"]:::external

    AND -->|"push/execute Lua script"| DEVICE
    IOS -->|"push/execute Lua script"| DEVICE
    DEVICE -->|"returns image data+metadata"| AND
    DEVICE -->|"returns image data+metadata"| IOS

    %% Asset Link
    AND --> LUA
    IOS --> LUA

    %% Documentation
    DOC["Architecture Diagram"]:::external

    %% Click Events
    click UI "https://github.com/citizenonex/frame_flutter_camera/blob/main/lib/main.dart"
    click MC "https://github.com/citizenonex/frame_flutter_camera/blob/main/lib/main.dart"
    click AND "https://github.com/citizenonex/frame_flutter_camera/blob/main/android/app/src/main/kotlin/com/example/frame_flutter_camera/MainActivity.kt"
    click IOS "https://github.com/citizenonex/frame_flutter_camera/blob/main/ios/Runner/AppDelegate.swift"
    click BRI "https://github.com/citizenonex/frame_flutter_camera/blob/main/ios/Runner/Runner-Bridging-Header.h"
    click LUA "https://github.com/citizenonex/frame_flutter_camera/blob/main/assets/frame_app.lua"
    click DOC "https://github.com/citizenonex/frame_flutter_camera/blob/main/docs/Frame App Architecture – Camera.svg"

    %% Styles
    classDef flutter fill:#AEDFF7,stroke:#333,stroke-width:1px
    classDef channel fill:#B2D8B2,stroke:#333,stroke-width:1px
    classDef native fill:#F7C27D,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
