Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sdk buildrunner #630

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ rootProject.allprojects {
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
compileSdkVersion 33

defaultConfig {
minSdkVersion 18
minSdkVersion 21
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
Expand Down
54 changes: 25 additions & 29 deletions lib/src/bridge/characteristics_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ mixin CharacteristicsMixin on FlutterBLE {
rawJsonValue = rawValue;
}
return _parseCharacteristicWithValueWithTransactionIdResponse(
peripheral,
rawJsonValue
).value;
peripheral, rawJsonValue)
.value;
});

Future<CharacteristicWithValue> readCharacteristicForDevice(
Expand All @@ -55,9 +54,7 @@ mixin CharacteristicsMixin on FlutterBLE {
rawJsonValue = rawValue;
}
return _parseCharacteristicWithValueWithTransactionIdResponse(
peripheral,
rawJsonValue
);
peripheral, rawJsonValue);
});

Future<CharacteristicWithValue> readCharacteristicForService(
Expand All @@ -83,9 +80,7 @@ mixin CharacteristicsMixin on FlutterBLE {
rawJsonValue = rawValue;
}
return _parseCharacteristicWithValueWithTransactionIdResponse(
peripheral,
rawJsonValue
);
peripheral, rawJsonValue);
});

Future<void> writeCharacteristicForIdentifier(
Expand Down Expand Up @@ -181,7 +176,9 @@ mixin CharacteristicsMixin on FlutterBLE {
transactionId,
characteristic._transactionId ?? "",
);
};
}

;

return _createMonitoringStream(
startMonitoring,
Expand Down Expand Up @@ -259,23 +256,20 @@ mixin CharacteristicsMixin on FlutterBLE {
String transactionId,
) {
Stream<CharacteristicWithValueAndTransactionId> stream =
_characteristicsMonitoringEvents
.map((rawValue) {
String rawJsonValue = "";
if (rawValue is String) {
rawJsonValue = rawValue;
}
return _parseCharacteristicWithValueWithTransactionIdResponse(
peripheral,
rawJsonValue
);
})
.where(filter)
.handleError((errorJson) =>
_throwErrorIfMatchesWithTransactionId(errorJson, transactionId))
.transform<CharacteristicWithValueAndTransactionId>(
CancelOnErrorStreamTransformer()
);
_characteristicsMonitoringEvents
.map((rawValue) {
String rawJsonValue = "";
if (rawValue is String) {
rawJsonValue = rawValue;
}
return _parseCharacteristicWithValueWithTransactionIdResponse(
peripheral, rawJsonValue);
})
.where(filter)
.handleError((errorJson) =>
_throwErrorIfMatchesWithTransactionId(errorJson, transactionId))
.transform<CharacteristicWithValueAndTransactionId>(
CancelOnErrorStreamTransformer());

StreamController<CharacteristicWithValueAndTransactionId> streamController =
StreamController.broadcast(
Expand Down Expand Up @@ -311,7 +305,8 @@ mixin CharacteristicsMixin on FlutterBLE {
rootObject["characteristic"], service, _manager);
}

void _throwErrorIfMatchesWithTransactionId(PlatformException errorJson, String transactionId) {
void _throwErrorIfMatchesWithTransactionId(
PlatformException errorJson, String transactionId) {
if (errorJson is PlatformException == false) {
return;
}
Expand All @@ -333,7 +328,8 @@ class CharacteristicWithValueAndTransactionId extends CharacteristicWithValue {
) : super.fromJson(jsonObject, service, manager);

CharacteristicWithValueAndTransactionId setTransactionId(
String transactionId) {
String? transactionId,
) {
_transactionId = transactionId;
return this;
}
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2.4.0
homepage: https://github.com/Polidea/FlutterBleLib

environment:
sdk: ">=2.12.0-0 <3.0.0"
sdk: ">=3.1.0 <4.0.0"
# Flutter versions prior to 1.10 did not support the flutter.plugin.platforms map.
flutter: ">=1.10.0 <2.0.0"

Expand All @@ -16,7 +16,7 @@ dependencies:

dev_dependencies:
mockito: ^5.0.3
build_runner: ^1.12.2
build_runner: ^2.4.6
pedantic: ^1.11.0

flutter_test:
Expand Down