Skip to content

feat: update example using flutter_blue_plus and simplifying the implementation#22

Open
ivanhercaz wants to merge 9 commits intoESP-Provisioning-BLE:mainfrom
ivanhercaz:feat/flutter-blue-plus-example
Open

feat: update example using flutter_blue_plus and simplifying the implementation#22
ivanhercaz wants to merge 9 commits intoESP-Provisioning-BLE:mainfrom
ivanhercaz:feat/flutter-blue-plus-example

Conversation

@ivanhercaz
Copy link
Copy Markdown
Collaborator

@ivanhercaz ivanhercaz commented Feb 28, 2026

Replaces the current example/ app with a new implementation built on flutter_blue_plus, moving the previous one to example_legacy/.

Closes ogabrielinacio/esp_provisioning_ble#9

Motivation

The existing example uses flutter_ble_lib_ios_15, which hasn't been updated in over 3 years. flutter_blue_plus is actively maintained and under continuous development, making it a more sustainable choice for a reference example.

The example intentionally avoids opinionated state management solutions (Riverpod, BLoC, etc.), relying only on ChangeNotifier + ListenableBuilder. This way it demonstrates how to integrate esp_provisioning_ble without influencing architectural decisions in the consumer's app.

A note on example structure

Rather than keeping multiple example apps inside example/ or only swapping the ProvTransport implementation, I chose to maintain the legacy example separately in example_legacy/ so it remains available as a reference. That said, other approaches could also work — for instance, housing multiple example apps inside example/ (e.g. example/flutter_blue_plus/, example/ble_lib/) or even a dedicated repository like esp_provisioning_ble_examples. Happy to discuss what makes the most sense long-term.

Test plan

  • Run cd example && flutter test — all 25 tests pass
  • Build and run on Android device with ESP32 running provisioning firmware
  • Verify BLE scan discovers devices with both keyword and name filters
  • Complete full provisioning flow: connect, establish session, scan WiFi, send credentials
  • Verify legacy example still builds from example_legacy/

Implements a BLE transport layer that enables communication with ESP32 devices.

The implementation handles the full provisioning lifecycle including device connection, MTU negotiation, service and characteristic discovery, and bidirectional data exchange. Characteristics are cached by endpoint name for efficient lookups during communication.
Adds a fully functional example app with a multi-screen provisioning workflow for ESP32 BLE devices. The app guides users through device discovery, secure connection establishment, and WiFi configuration.
Updates the scanner service to accept both `withKeywords` and `withNames` parameters, forwarding them directly to the platform layer. This provides greater flexibility in device discovery while maintaining platform-level filtering efficiency.
Introduces dependency injection for transport and provisioning object creation, enabling easier testing and flexibility in how these dependencies are instantiated.

Adds constructor parameters to accept optional factory functions for creating transport and provisioning instances, with sensible defaults that maintain existing behavior. This decouples the service from concrete implementations and allows consumers to provide custom factories for testing or alternative implementations.

Changes the transport field type from concrete TransportBLE to the abstract ProvTransport interface, improving abstraction and testability.
Adds mocktail dependency for mocking and introduces unit test coverage for core services and widgets in the example app.
@ivanhercaz ivanhercaz self-assigned this Feb 28, 2026
@ivanhercaz ivanhercaz added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 28, 2026
@ivanhercaz ivanhercaz added examples Something related with existing or planned examples. type/documentation Improvements or additions to documentation status/needs-review Ready for review and removed documentation Improvements or additions to documentation enhancement New feature or request labels Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples Something related with existing or planned examples. status/needs-review Ready for review type/documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant