How tinnci/flutter_ble_hid_peripheral works
Project type and purpose
• This is a Flutter plugin (an open-source tool) whose purpose is to let a Flutter app emulate a BLE Human Interface Device (keyboard/mouse) on Android.
• Key indicators:
• Top-level lib/ directory with Dart code and platform‐interface abstractions.
• android/ directory containing Kotlin source for BLE HID peripheral logic.
• example/ directory showing a sample Flutter app integrating the plugin.
File structure
• Top‐level directories:
• lib/ – Dart API entrypoints, platform interface, MethodChannel implementation.
• android/ – native Android plugin code (Kotlin), BLE HID peripheral classes.
• example/ – sample Flutter app using the plugin.
• test/ – Dart unit tests for plugin APIs and MethodChannel.
• Patterns:
• Plugin architecture: separation between platform‐agnostic interface (flutter_ble_hid_peripheral_platform_interface.dart), MethodChannel bridge (flutter_ble_hid_peripheral_method_channel.dart), and platform implementation (FlutterBleHidPeripheralPlugin.kt).
• Native code implements BLE HID via Kotlin: HidPeripheral, KeyboardPeripheral, MousePeripheral, and utility classes under jp.kshoji.
• Config & Build:
• pubspec.yaml – declares Dart package & dependencies.
• build.gradle / settings.gradle – Android plugin module configuration.
README for architecture clues
• Describes plugin usage flow: Dart → permission checks → API calls (startKeyboard, sendKeys, etc.) → native BLE HID operations.
• Notes lack of iOS implementation (so only Android path is drawn).