feat: update example using flutter_blue_plus and simplifying the implementation#22
Open
ivanhercaz wants to merge 9 commits intoESP-Provisioning-BLE:mainfrom
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the current
example/app with a new implementation built onflutter_blue_plus, moving the previous one toexample_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_plusis 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 integrateesp_provisioning_blewithout influencing architectural decisions in the consumer's app.A note on example structure
Rather than keeping multiple example apps inside
example/or only swapping theProvTransportimplementation, I chose to maintain the legacy example separately inexample_legacy/so it remains available as a reference. That said, other approaches could also work — for instance, housing multiple example apps insideexample/(e.g.example/flutter_blue_plus/,example/ble_lib/) or even a dedicated repository likeesp_provisioning_ble_examples. Happy to discuss what makes the most sense long-term.Test plan
cd example && flutter test— all 25 tests passexample_legacy/