Skip to content

Commit

Permalink
Add a placeholder implementation for non-mobile platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-kim committed Mar 21, 2023
1 parent 9aa9957 commit 90b5ba0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions packages/flutter_reactive_ble/lib/src/reactive_ble.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +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 @@ -182,3 +182,5 @@ abstract class ReactiveBlePlatform extends PlatformInterface {
'requesConnectionPriority has not been implemented.');
}
}

class _PlaceholderImplementation extends ReactiveBlePlatform {}

0 comments on commit 90b5ba0

Please sign in to comment.