# openflutter/fluwx architecture

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

- Interactive diagram: https://gitdiagram.com/openflutter/fluwx
- Repository: https://github.com/openflutter/fluwx

## Overview

##### Project type and purpose
- Fluwx is an open-source, multi-platform Flutter plugin that wraps the native WeChat SDK APIs (Android, iOS, OpenHarmony) and exposes them to Dart code. It is _not_ a full-stack application with a database, but rather a library/tool that integrates with host apps via method channels and platform-specific code.

##### File structure
- Top-level directories:
- android/ – Android plugin implementation in Kotlin/Java, manifest, resources
- ios/ – iOS plugin implementation in Objective-C, podspec, resources
- ohos/ – OpenHarmony plugin implementation in ETS/TypeScript
- lib/ – Dart API surface, platform interface, method channel, data models
- example/ – Sample Flutter app demonstrating plugin usage on Android, iOS, web, OHOS
- doc/ – Markdown docs for capabilities, migration, QA
- test/ – Unit and integration tests for Dart and method channel
- .github/, .ci/ – CI workflows, Dockerfile, publish actions
- You see an _Adapter/Bridge pattern_ via Flutter’s MethodChannel: Dart code calls MethodChannel → native handler in each platform module.

##### README for additional insights
- Confirms that Fluwx:
- Initializes/registers WeChat SDK on each platform
- Supports share, auth, payment, mini-program, subscription
- Requires configuration in pubspec.yaml
- Provides documentation for each feature in doc/*.md

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Example App
    ExampleApp["Example App"]:::dart
    ExampleApp -->|imports Dart API| DartAPI

    %% Dart API Layer
    subgraph "Dart API Layer"
        lib_fluwx["fluwx.dart"]:::dart
        foundation["foundation/"]:::dart
        wechat_enums["wechat_enums.dart"]:::dart
        wechat_file["wechat_file.dart"]:::dart
    end
    DartAPI[Dart API Layer]:::dart
    DartAPI -->|calls MethodChannel| MethodChannelLayer
    lib_fluwx -->|defines API| foundation
    lib_fluwx --> wechat_enums
    lib_fluwx --> wechat_file

    %% MethodChannel Layer
    subgraph "Platform Interface & MethodChannel"
        pi["fluwx_platform_interface.dart"]:::dart
        mc["fluwx_method_channel.dart"]:::dart
    end
    MethodChannelLayer["MethodChannel Layer"]:::dart
    MethodChannelLayer --> pi
    MethodChannelLayer --> mc

    %% Platform Implementations
    subgraph "Platform Implementations"
        subgraph Android
            android_plugin["FluwxPlugin.kt"]:::platform
            android_handlers["handlers/"]:::platform
            android_io["io/"]:::platform
            android_utils["utils/"]:::platform
            android_wxentry["FluwxWXEntryActivity.kt"]:::platform
        end
        subgraph iOS
            ios_plugin_m["FluwxPlugin.m"]:::platform
            ios_plugin_h["FluwxPlugin.h"]:::platform
            ios_delegate_m["FluwxDelegate.m"]:::platform
            ios_delegate_h["FluwxDelegate.h"]:::platform
            ios_thumb["ThumbnailHelper.m"]:::platform
            ios_strutil["FluwxStringUtil.m"]:::platform
            ios_ns["NSStringWrapper.m"]:::platform
        end
        subgraph OpenHarmony
            ohos_plugin["FluwxPlugin.ets"]:::platform
            ohos_auth["FluwxAuthHandler.ets"]:::platform
            ohos_share["FluwxShareHandler.ets"]:::platform
            ohos_wxapi["WXAPiHandler.ets"]:::platform
        end
    end
    mc --> android_plugin
    mc --> ios_plugin_m
    mc --> ohos_plugin

    %% WeChat SDK
    WeChatSDK["WeChat SDK"]:::sdk
    android_handlers --> WeChatSDK
    ios_delegate_m --> WeChatSDK
    ohos_wxapi --> WeChatSDK

    %% CI/CD
    subgraph "CI/CD"
        ci_build["build_test.yml"]:::ci
        ci_publish["publish.yml"]:::ci
        docker["Dockerfile"]:::ci
    end

    %% Documentation & Tests
    subgraph "Docs & Tests"
        docs["doc/"]:::docs
        test_root["test/"]:::docs
        test_android["FluwxPluginTest.kt"]:::docs
        test_mc["fluwx_method_channel_test.dart"]:::docs
        test_dart["fluwx_test.dart"]:::docs
    end

    %% Flows to CI and Docs
    ExampleApp -->|CI build/test| ci_build
    ExampleApp -->|Publish| ci_publish
    ExampleApp --> docker
    ExampleApp --> docs
    ExampleApp --> test_root

    %% Click Events
    click lib_fluwx "https://github.com/openflutter/fluwx/blob/main/lib/fluwx.dart"
    click foundation "https://github.com/openflutter/fluwx/tree/main/lib/src/foundation/"
    click wechat_enums "https://github.com/openflutter/fluwx/blob/main/lib/src/wechat_enums.dart"
    click wechat_file "https://github.com/openflutter/fluwx/blob/main/lib/src/wechat_file.dart"
    click pi "https://github.com/openflutter/fluwx/blob/main/lib/src/method_channel/fluwx_platform_interface.dart"
    click mc "https://github.com/openflutter/fluwx/blob/main/lib/src/method_channel/fluwx_method_channel.dart"
    click android_plugin "https://github.com/openflutter/fluwx/blob/main/android/src/main/kotlin/com/jarvan/fluwx/FluwxPlugin.kt"
    click android_handlers "https://github.com/openflutter/fluwx/tree/main/android/src/main/kotlin/com/jarvan/fluwx/handlers/"
    click android_io "https://github.com/openflutter/fluwx/tree/main/android/src/main/kotlin/com/jarvan/fluwx/io/"
    click android_utils "https://github.com/openflutter/fluwx/tree/main/android/src/main/kotlin/com/jarvan/fluwx/utils/"
    click android_wxentry "https://github.com/openflutter/fluwx/blob/main/android/src/main/kotlin/com/jarvan/fluwx/wxapi/FluwxWXEntryActivity.kt"
    click ios_plugin_m "https://github.com/openflutter/fluwx/blob/main/ios/Classes/FluwxPlugin.m"
    click ios_plugin_h "https://github.com/openflutter/fluwx/blob/main/ios/Classes/public/FluwxPlugin.h"
    click ios_delegate_m "https://github.com/openflutter/fluwx/blob/main/ios/Classes/FluwxDelegate.m"
    click ios_delegate_h "https://github.com/openflutter/fluwx/blob/main/ios/Classes/public/FluwxDelegate.h"
    click ios_thumb "https://github.com/openflutter/fluwx/blob/main/ios/Classes/ThumbnailHelper.m"
    click ios_strutil "https://github.com/openflutter/fluwx/blob/main/ios/Classes/FluwxStringUtil.m"
    click ios_ns "https://github.com/openflutter/fluwx/blob/main/ios/Classes/NSStringWrapper.m"
    click ohos_plugin "https://github.com/openflutter/fluwx/blob/main/ohos/src/main/ets/components/plugin/FluwxPlugin.ets"
    click ohos_auth "https://github.com/openflutter/fluwx/blob/main/ohos/src/main/ets/components/plugin/handlers/FluwxAuthHandler.ets"
    click ohos_share "https://github.com/openflutter/fluwx/blob/main/ohos/src/main/ets/components/plugin/handlers/FluwxShareHandler.ets"
    click ohos_wxapi "https://github.com/openflutter/fluwx/blob/main/ohos/src/main/ets/components/plugin/handlers/WXAPiHandler.ets"
    click example_lib "https://github.com/openflutter/fluwx/tree/main/example/lib/"
    click example_android "https://github.com/openflutter/fluwx/tree/main/example/android/"
    click example_ios "https://github.com/openflutter/fluwx/tree/main/example/ios/"
    click example_ohos "https://github.com/openflutter/fluwx/tree/main/example/ohos/"
    click ci_build "https://github.com/openflutter/fluwx/blob/main/.github/workflows/build_test.yml"
    click ci_publish "https://github.com/openflutter/fluwx/blob/main/.github/workflows/publish.yml"
    click docker "https://github.com/openflutter/fluwx/tree/main/.ci/Dockerfile"
    click docs "https://github.com/openflutter/fluwx/tree/main/doc/"
    click test_root "https://github.com/openflutter/fluwx/tree/main/test/"
    click test_android "https://github.com/openflutter/fluwx/blob/main/android/src/test/kotlin/com/jarvan/fluwx/FluwxPluginTest.kt"
    click test_mc "https://github.com/openflutter/fluwx/blob/main/test/fluwx_method_channel_test.dart"
    click test_dart "https://github.com/openflutter/fluwx/blob/main/test/fluwx_test.dart"

    %% Styles
    classDef dart fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef platform fill:#98FB98,stroke:#333,stroke-width:1px
    classDef ci fill:#FFFACD,stroke:#333,stroke-width:1px
    classDef docs fill:#FFFACD,stroke:#333,stroke-width:1px
    classDef sdk fill:#D3D3D3,stroke:#333,stroke-width:1px
```
