Skip to content

Commit

Permalink
Add a placeholder implementation for non-mobile platforms (PhilipsHue…
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-kim authored and cenumi committed Sep 19, 2023
1 parent c446d6c commit b363bba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/flutter_reactive_ble/lib/src/reactive_ble.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ class FlutterReactiveBle {
print,
);

ReactiveBlePlatform.instance = const ReactiveBleMobilePlatformFactory().create(
logger: _debugLogger,
);
if (Platform.isAndroid || Platform.isIOS) {
ReactiveBlePlatform.instance =
const ReactiveBleMobilePlatformFactory().create(
logger: _debugLogger,
);
}

_blePlatform = ReactiveBlePlatform.instance;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract class ReactiveBlePlatform extends PlatformInterface {
ReactiveBlePlatform() : super(token: _token);
static final Object _token = Object();

static late ReactiveBlePlatform _instance;
static ReactiveBlePlatform _instance = _PlaceholderImplementation();

static ReactiveBlePlatform get instance => _instance;

Expand Down Expand Up @@ -186,3 +186,5 @@ abstract class ReactiveBlePlatform extends PlatformInterface {
'requestConnectionPriority has not been implemented.');
}
}

class _PlaceholderImplementation extends ReactiveBlePlatform {}

0 comments on commit b363bba

Please sign in to comment.