diff --git a/.github/workflows/esp_provisioning.yaml b/.github/workflows/esp_provisioning.yaml index 11aa213..e22bc15 100644 --- a/.github/workflows/esp_provisioning.yaml +++ b/.github/workflows/esp_provisioning.yaml @@ -30,7 +30,7 @@ jobs: uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1 with: flutter_channel: stable - flutter_version: 3.27.2 + flutter_version: 3.44.0 working_directory: esp_provisioning format_line_length: "120" coverage_excludes: '**/*.g.dart **/*.freezed.dart' diff --git a/esp_provisioning/example/android/app/build.gradle b/esp_provisioning/example/android/app/build.gradle index 8699f6e..4bd55bf 100644 --- a/esp_provisioning/example/android/app/build.gradle +++ b/esp_provisioning/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" +} def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,10 +22,6 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { namespace 'com.spindance.esp_provisioning.example' compileSdk flutter.compileSdkVersion @@ -63,7 +60,3 @@ android { flutter { source '../..' } - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/esp_provisioning/example/android/build.gradle b/esp_provisioning/example/android/build.gradle index 68b15a8..bc157bd 100644 --- a/esp_provisioning/example/android/build.gradle +++ b/esp_provisioning/example/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.9.0' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:8.1.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() diff --git a/esp_provisioning/example/android/gradle/wrapper/gradle-wrapper.properties b/esp_provisioning/example/android/gradle/wrapper/gradle-wrapper.properties index 89e56bd..e6b38c2 100644 --- a/esp_provisioning/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/esp_provisioning/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip diff --git a/esp_provisioning/example/android/settings.gradle b/esp_provisioning/example/android/settings.gradle index 44e62bc..b3832f7 100644 --- a/esp_provisioning/example/android/settings.gradle +++ b/esp_provisioning/example/android/settings.gradle @@ -1,11 +1,25 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.1.0" apply false + id "org.jetbrains.kotlin.android" version "1.9.0" apply false +} + +include ":app" \ No newline at end of file diff --git a/esp_provisioning/lib/esp_provisioning.dart b/esp_provisioning/lib/esp_provisioning.dart index ad36859..1930de5 100644 --- a/esp_provisioning/lib/esp_provisioning.dart +++ b/esp_provisioning/lib/esp_provisioning.dart @@ -52,7 +52,9 @@ class EspProvisioning { int responseTimeoutSec = defaultResponseTimeoutSec, ]) async { // Get the access points as JSON strings. - final accessPointJsonStrings = await _espPlatform.getEspAccessPoints(deviceName).timeout( + final accessPointJsonStrings = await _espPlatform + .getEspAccessPoints(deviceName) + .timeout( Duration(seconds: responseTimeoutSec), onTimeout: () => throw TimeoutException('Failed to get access points within $responseTimeoutSec seconds.'), ); @@ -61,8 +63,8 @@ class EspProvisioning { final accessPointMaps = accessPointJsonStrings.map((e) => json.decode(e) as Map).toList(); // Convert the maps into EspWifiAccessPoint objects and return the sorted by SSID. - final accessPoints = accessPointMaps.map(EspWifiAccessPoint.fromJson).toList() - ..sort((a, b) => a.ssid.compareTo(b.ssid)); + final accessPoints = + accessPointMaps.map(EspWifiAccessPoint.fromJson).toList()..sort((a, b) => a.ssid.compareTo(b.ssid)); return accessPoints; } @@ -75,11 +77,12 @@ class EspProvisioning { String ssid, String password, [ int responseTimeoutSec = defaultResponseTimeoutSec, - ]) => - _espPlatform.setEspAccessPoint(deviceName, ssid, password).timeout( - Duration(seconds: responseTimeoutSec), - onTimeout: () => throw TimeoutException('Failed to set access point within $responseTimeoutSec seconds.'), - ); + ]) => _espPlatform + .setEspAccessPoint(deviceName, ssid, password) + .timeout( + Duration(seconds: responseTimeoutSec), + onTimeout: () => throw TimeoutException('Failed to set access point within $responseTimeoutSec seconds.'), + ); /// Sends [data] to the specified [endpoint] on the device with [deviceName], returning a [Uint8List] response. /// [responseTimeoutSec] is optional and defaults to [defaultResponseTimeoutSec]. @@ -88,9 +91,10 @@ class EspProvisioning { String endpoint, Uint8List data, [ int responseTimeoutSec = defaultResponseTimeoutSec, - ]) => - _espPlatform.sendData(deviceName, endpoint, data).timeout( - Duration(seconds: responseTimeoutSec), - onTimeout: () => throw TimeoutException('Failed to send data within $responseTimeoutSec seconds.'), - ); + ]) => _espPlatform + .sendData(deviceName, endpoint, data) + .timeout( + Duration(seconds: responseTimeoutSec), + onTimeout: () => throw TimeoutException('Failed to send data within $responseTimeoutSec seconds.'), + ); } diff --git a/esp_provisioning/lib/src/esp_ble_device.dart b/esp_provisioning/lib/src/esp_ble_device.dart index e86973e..5afe42d 100644 --- a/esp_provisioning/lib/src/esp_ble_device.dart +++ b/esp_provisioning/lib/src/esp_ble_device.dart @@ -6,7 +6,7 @@ part 'esp_ble_device.freezed.dart'; /// Represents an ESP32 device. @freezed -class EspBleDevice with _$EspBleDevice { +abstract class EspBleDevice with _$EspBleDevice { /// Creates a new instance of [EspBleDevice].time. const factory EspBleDevice({ /// The device's advertised name. diff --git a/esp_provisioning/lib/src/esp_ble_device.freezed.dart b/esp_provisioning/lib/src/esp_ble_device.freezed.dart index 006450e..fa6bdfe 100644 --- a/esp_provisioning/lib/src/esp_ble_device.freezed.dart +++ b/esp_provisioning/lib/src/esp_ble_device.freezed.dart @@ -1,5 +1,5 @@ -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark @@ -9,168 +9,288 @@ part of 'esp_ble_device.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); +/// @nodoc +mixin _$EspBleDevice implements DiagnosticableTreeMixin { + +/// The device's advertised name. + String get name;/// The device's BLE RSSI. The Espressif iOS library does not provide this value; on iOS it will always be 0. + int get rssi; +/// Create a copy of EspBleDevice +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$EspBleDeviceCopyWith get copyWith => _$EspBleDeviceCopyWithImpl(this as EspBleDevice, _$identity); + + /// Serializes this EspBleDevice to a JSON map. + Map toJson(); -EspBleDevice _$EspBleDeviceFromJson(Map json) { - return _EspBleDevice.fromJson(json); +@override +void debugFillProperties(DiagnosticPropertiesBuilder properties) { + properties + ..add(DiagnosticsProperty('type', 'EspBleDevice')) + ..add(DiagnosticsProperty('name', name))..add(DiagnosticsProperty('rssi', rssi)); } -/// @nodoc -mixin _$EspBleDevice { - /// The device's advertised name. - String get name => throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is EspBleDevice&&(identical(other.name, name) || other.name == name)&&(identical(other.rssi, rssi) || other.rssi == rssi)); +} - /// The device's BLE RSSI. The Espressif iOS library does not provide this value; on iOS it will always be 0. - int get rssi => throw _privateConstructorUsedError; +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,name,rssi); - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $EspBleDeviceCopyWith get copyWith => throw _privateConstructorUsedError; +@override +String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) { + return 'EspBleDevice(name: $name, rssi: $rssi)'; } -/// @nodoc -abstract class $EspBleDeviceCopyWith<$Res> { - factory $EspBleDeviceCopyWith(EspBleDevice value, $Res Function(EspBleDevice) then) = - _$EspBleDeviceCopyWithImpl<$Res, EspBleDevice>; - @useResult - $Res call({String name, int rssi}); + } /// @nodoc -class _$EspBleDeviceCopyWithImpl<$Res, $Val extends EspBleDevice> implements $EspBleDeviceCopyWith<$Res> { - _$EspBleDeviceCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? name = null, - Object? rssi = null, - }) { - return _then(_value.copyWith( - name: null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - rssi: null == rssi - ? _value.rssi - : rssi // ignore: cast_nullable_to_non_nullable - as int, - ) as $Val); - } -} +abstract mixin class $EspBleDeviceCopyWith<$Res> { + factory $EspBleDeviceCopyWith(EspBleDevice value, $Res Function(EspBleDevice) _then) = _$EspBleDeviceCopyWithImpl; +@useResult +$Res call({ + String name, int rssi +}); + + + +} /// @nodoc -abstract class _$$EspBleDeviceImplCopyWith<$Res> implements $EspBleDeviceCopyWith<$Res> { - factory _$$EspBleDeviceImplCopyWith(_$EspBleDeviceImpl value, $Res Function(_$EspBleDeviceImpl) then) = - __$$EspBleDeviceImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String name, int rssi}); +class _$EspBleDeviceCopyWithImpl<$Res> + implements $EspBleDeviceCopyWith<$Res> { + _$EspBleDeviceCopyWithImpl(this._self, this._then); + + final EspBleDevice _self; + final $Res Function(EspBleDevice) _then; + +/// Create a copy of EspBleDevice +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? name = null,Object? rssi = null,}) { + return _then(_self.copyWith( +name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,rssi: null == rssi ? _self.rssi : rssi // ignore: cast_nullable_to_non_nullable +as int, + )); +} + +} + + +/// Adds pattern-matching-related methods to [EspBleDevice]. +extension EspBleDevicePatterns on EspBleDevice { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _EspBleDevice value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _EspBleDevice() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _EspBleDevice value) $default,){ +final _that = this; +switch (_that) { +case _EspBleDevice(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _EspBleDevice value)? $default,){ +final _that = this; +switch (_that) { +case _EspBleDevice() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String name, int rssi)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _EspBleDevice() when $default != null: +return $default(_that.name,_that.rssi);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String name, int rssi) $default,) {final _that = this; +switch (_that) { +case _EspBleDevice(): +return $default(_that.name,_that.rssi);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String name, int rssi)? $default,) {final _that = this; +switch (_that) { +case _EspBleDevice() when $default != null: +return $default(_that.name,_that.rssi);case _: + return null; + +} } -/// @nodoc -class __$$EspBleDeviceImplCopyWithImpl<$Res> extends _$EspBleDeviceCopyWithImpl<$Res, _$EspBleDeviceImpl> - implements _$$EspBleDeviceImplCopyWith<$Res> { - __$$EspBleDeviceImplCopyWithImpl(_$EspBleDeviceImpl _value, $Res Function(_$EspBleDeviceImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? name = null, - Object? rssi = null, - }) { - return _then(_$EspBleDeviceImpl( - name: null == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String, - rssi: null == rssi - ? _value.rssi - : rssi // ignore: cast_nullable_to_non_nullable - as int, - )); - } } /// @nodoc @JsonSerializable() -class _$EspBleDeviceImpl with DiagnosticableTreeMixin implements _EspBleDevice { - const _$EspBleDeviceImpl({required this.name, required this.rssi}); - - factory _$EspBleDeviceImpl.fromJson(Map json) => _$$EspBleDeviceImplFromJson(json); - - /// The device's advertised name. - @override - final String name; - - /// The device's BLE RSSI. The Espressif iOS library does not provide this value; on iOS it will always be 0. - @override - final int rssi; - - @override - String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'EspBleDevice(name: $name, rssi: $rssi)'; - } - - @override - void debugFillProperties(DiagnosticPropertiesBuilder properties) { - super.debugFillProperties(properties); - properties - ..add(DiagnosticsProperty('type', 'EspBleDevice')) - ..add(DiagnosticsProperty('name', name)) - ..add(DiagnosticsProperty('rssi', rssi)); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$EspBleDeviceImpl && - (identical(other.name, name) || other.name == name) && - (identical(other.rssi, rssi) || other.rssi == rssi)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash(runtimeType, name, rssi); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$EspBleDeviceImplCopyWith<_$EspBleDeviceImpl> get copyWith => - __$$EspBleDeviceImplCopyWithImpl<_$EspBleDeviceImpl>(this, _$identity); - - @override - Map toJson() { - return _$$EspBleDeviceImplToJson( - this, - ); - } -} - -abstract class _EspBleDevice implements EspBleDevice { - const factory _EspBleDevice({required final String name, required final int rssi}) = _$EspBleDeviceImpl; - - factory _EspBleDevice.fromJson(Map json) = _$EspBleDeviceImpl.fromJson; - - @override - - /// The device's advertised name. - String get name; - @override - - /// The device's BLE RSSI. The Espressif iOS library does not provide this value; on iOS it will always be 0. - int get rssi; - @override - @JsonKey(ignore: true) - _$$EspBleDeviceImplCopyWith<_$EspBleDeviceImpl> get copyWith => throw _privateConstructorUsedError; + +class _EspBleDevice with DiagnosticableTreeMixin implements EspBleDevice { + const _EspBleDevice({required this.name, required this.rssi}); + factory _EspBleDevice.fromJson(Map json) => _$EspBleDeviceFromJson(json); + +/// The device's advertised name. +@override final String name; +/// The device's BLE RSSI. The Espressif iOS library does not provide this value; on iOS it will always be 0. +@override final int rssi; + +/// Create a copy of EspBleDevice +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$EspBleDeviceCopyWith<_EspBleDevice> get copyWith => __$EspBleDeviceCopyWithImpl<_EspBleDevice>(this, _$identity); + +@override +Map toJson() { + return _$EspBleDeviceToJson(this, ); +} +@override +void debugFillProperties(DiagnosticPropertiesBuilder properties) { + properties + ..add(DiagnosticsProperty('type', 'EspBleDevice')) + ..add(DiagnosticsProperty('name', name))..add(DiagnosticsProperty('rssi', rssi)); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _EspBleDevice&&(identical(other.name, name) || other.name == name)&&(identical(other.rssi, rssi) || other.rssi == rssi)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,name,rssi); + +@override +String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) { + return 'EspBleDevice(name: $name, rssi: $rssi)'; } + + +} + +/// @nodoc +abstract mixin class _$EspBleDeviceCopyWith<$Res> implements $EspBleDeviceCopyWith<$Res> { + factory _$EspBleDeviceCopyWith(_EspBleDevice value, $Res Function(_EspBleDevice) _then) = __$EspBleDeviceCopyWithImpl; +@override @useResult +$Res call({ + String name, int rssi +}); + + + + +} +/// @nodoc +class __$EspBleDeviceCopyWithImpl<$Res> + implements _$EspBleDeviceCopyWith<$Res> { + __$EspBleDeviceCopyWithImpl(this._self, this._then); + + final _EspBleDevice _self; + final $Res Function(_EspBleDevice) _then; + +/// Create a copy of EspBleDevice +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? name = null,Object? rssi = null,}) { + return _then(_EspBleDevice( +name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String,rssi: null == rssi ? _self.rssi : rssi // ignore: cast_nullable_to_non_nullable +as int, + )); +} + + +} + +// dart format on diff --git a/esp_provisioning/lib/src/esp_ble_device.g.dart b/esp_provisioning/lib/src/esp_ble_device.g.dart index c639ae7..d771d9a 100644 --- a/esp_provisioning/lib/src/esp_ble_device.g.dart +++ b/esp_provisioning/lib/src/esp_ble_device.g.dart @@ -6,12 +6,11 @@ part of 'esp_ble_device.dart'; // JsonSerializableGenerator // ************************************************************************** -_$EspBleDeviceImpl _$$EspBleDeviceImplFromJson(Map json) => _$EspBleDeviceImpl( +_EspBleDevice _$EspBleDeviceFromJson(Map json) => + _EspBleDevice( name: json['name'] as String, - rssi: json['rssi'] as int, + rssi: (json['rssi'] as num).toInt(), ); -Map _$$EspBleDeviceImplToJson(_$EspBleDeviceImpl instance) => { - 'name': instance.name, - 'rssi': instance.rssi, - }; +Map _$EspBleDeviceToJson(_EspBleDevice instance) => + {'name': instance.name, 'rssi': instance.rssi}; diff --git a/esp_provisioning/lib/src/esp_wifi_access_point.dart b/esp_provisioning/lib/src/esp_wifi_access_point.dart index 540ddb5..56de1de 100644 --- a/esp_provisioning/lib/src/esp_wifi_access_point.dart +++ b/esp_provisioning/lib/src/esp_wifi_access_point.dart @@ -8,7 +8,7 @@ part 'esp_wifi_access_point.g.dart'; /// Represents a Wi-Fi access point as reported by an ESP device. @freezed -class EspWifiAccessPoint with _$EspWifiAccessPoint { +abstract class EspWifiAccessPoint with _$EspWifiAccessPoint { /// Creates a new instance of [EspWifiAccessPoint]. const factory EspWifiAccessPoint({ /// The SSID of the access point. diff --git a/esp_provisioning/lib/src/esp_wifi_access_point.freezed.dart b/esp_provisioning/lib/src/esp_wifi_access_point.freezed.dart index a581c61..c6b5fb3 100644 --- a/esp_provisioning/lib/src/esp_wifi_access_point.freezed.dart +++ b/esp_provisioning/lib/src/esp_wifi_access_point.freezed.dart @@ -1,5 +1,5 @@ -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark @@ -9,222 +9,298 @@ part of 'esp_wifi_access_point.dart'; // FreezedGenerator // ************************************************************************** +// dart format off T _$identity(T value) => value; -final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); - -EspWifiAccessPoint _$EspWifiAccessPointFromJson(Map json) { - return _EspWifiAccessPoint.fromJson(json); +/// @nodoc +mixin _$EspWifiAccessPoint implements DiagnosticableTreeMixin { + +/// The SSID of the access point. + String get ssid;/// The channel of the access point. On Android, channel is unsupported so the value is always 0. + int get channel;/// The security configuration of the access point. + EspWifiAccessPointSecurity get security;/// The Wi-Fi signal strength of the access point. + int get rssi; +/// Create a copy of EspWifiAccessPoint +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$EspWifiAccessPointCopyWith get copyWith => _$EspWifiAccessPointCopyWithImpl(this as EspWifiAccessPoint, _$identity); + + /// Serializes this EspWifiAccessPoint to a JSON map. + Map toJson(); + +@override +void debugFillProperties(DiagnosticPropertiesBuilder properties) { + properties + ..add(DiagnosticsProperty('type', 'EspWifiAccessPoint')) + ..add(DiagnosticsProperty('ssid', ssid))..add(DiagnosticsProperty('channel', channel))..add(DiagnosticsProperty('security', security))..add(DiagnosticsProperty('rssi', rssi)); } -/// @nodoc -mixin _$EspWifiAccessPoint { - /// The SSID of the access point. - String get ssid => throw _privateConstructorUsedError; +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is EspWifiAccessPoint&&(identical(other.ssid, ssid) || other.ssid == ssid)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.security, security) || other.security == security)&&(identical(other.rssi, rssi) || other.rssi == rssi)); +} - /// The channel of the access point. On Android, channel is unsupported so the value is always 0. - int get channel => throw _privateConstructorUsedError; +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,ssid,channel,security,rssi); - /// The security configuration of the access point. - EspWifiAccessPointSecurity get security => throw _privateConstructorUsedError; +@override +String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) { + return 'EspWifiAccessPoint(ssid: $ssid, channel: $channel, security: $security, rssi: $rssi)'; +} - /// The Wi-Fi signal strength of the access point. - int get rssi => throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $EspWifiAccessPointCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $EspWifiAccessPointCopyWith<$Res> { - factory $EspWifiAccessPointCopyWith(EspWifiAccessPoint value, $Res Function(EspWifiAccessPoint) then) = - _$EspWifiAccessPointCopyWithImpl<$Res, EspWifiAccessPoint>; - @useResult - $Res call({String ssid, int channel, EspWifiAccessPointSecurity security, int rssi}); -} +abstract mixin class $EspWifiAccessPointCopyWith<$Res> { + factory $EspWifiAccessPointCopyWith(EspWifiAccessPoint value, $Res Function(EspWifiAccessPoint) _then) = _$EspWifiAccessPointCopyWithImpl; +@useResult +$Res call({ + String ssid, int channel, EspWifiAccessPointSecurity security, int rssi +}); + + + +} /// @nodoc -class _$EspWifiAccessPointCopyWithImpl<$Res, $Val extends EspWifiAccessPoint> +class _$EspWifiAccessPointCopyWithImpl<$Res> implements $EspWifiAccessPointCopyWith<$Res> { - _$EspWifiAccessPointCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? ssid = null, - Object? channel = null, - Object? security = null, - Object? rssi = null, - }) { - return _then(_value.copyWith( - ssid: null == ssid - ? _value.ssid - : ssid // ignore: cast_nullable_to_non_nullable - as String, - channel: null == channel - ? _value.channel - : channel // ignore: cast_nullable_to_non_nullable - as int, - security: null == security - ? _value.security - : security // ignore: cast_nullable_to_non_nullable - as EspWifiAccessPointSecurity, - rssi: null == rssi - ? _value.rssi - : rssi // ignore: cast_nullable_to_non_nullable - as int, - ) as $Val); - } + _$EspWifiAccessPointCopyWithImpl(this._self, this._then); + + final EspWifiAccessPoint _self; + final $Res Function(EspWifiAccessPoint) _then; + +/// Create a copy of EspWifiAccessPoint +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? ssid = null,Object? channel = null,Object? security = null,Object? rssi = null,}) { + return _then(_self.copyWith( +ssid: null == ssid ? _self.ssid : ssid // ignore: cast_nullable_to_non_nullable +as String,channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable +as int,security: null == security ? _self.security : security // ignore: cast_nullable_to_non_nullable +as EspWifiAccessPointSecurity,rssi: null == rssi ? _self.rssi : rssi // ignore: cast_nullable_to_non_nullable +as int, + )); } -/// @nodoc -abstract class _$$EspWifiAccessPointImplCopyWith<$Res> implements $EspWifiAccessPointCopyWith<$Res> { - factory _$$EspWifiAccessPointImplCopyWith( - _$EspWifiAccessPointImpl value, $Res Function(_$EspWifiAccessPointImpl) then) = - __$$EspWifiAccessPointImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({String ssid, int channel, EspWifiAccessPointSecurity security, int rssi}); } -/// @nodoc -class __$$EspWifiAccessPointImplCopyWithImpl<$Res> - extends _$EspWifiAccessPointCopyWithImpl<$Res, _$EspWifiAccessPointImpl> - implements _$$EspWifiAccessPointImplCopyWith<$Res> { - __$$EspWifiAccessPointImplCopyWithImpl(_$EspWifiAccessPointImpl _value, $Res Function(_$EspWifiAccessPointImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? ssid = null, - Object? channel = null, - Object? security = null, - Object? rssi = null, - }) { - return _then(_$EspWifiAccessPointImpl( - ssid: null == ssid - ? _value.ssid - : ssid // ignore: cast_nullable_to_non_nullable - as String, - channel: null == channel - ? _value.channel - : channel // ignore: cast_nullable_to_non_nullable - as int, - security: null == security - ? _value.security - : security // ignore: cast_nullable_to_non_nullable - as EspWifiAccessPointSecurity, - rssi: null == rssi - ? _value.rssi - : rssi // ignore: cast_nullable_to_non_nullable - as int, - )); - } + +/// Adds pattern-matching-related methods to [EspWifiAccessPoint]. +extension EspWifiAccessPointPatterns on EspWifiAccessPoint { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap(TResult Function( _EspWifiAccessPoint value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _EspWifiAccessPoint() when $default != null: +return $default(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map(TResult Function( _EspWifiAccessPoint value) $default,){ +final _that = this; +switch (_that) { +case _EspWifiAccessPoint(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _EspWifiAccessPoint value)? $default,){ +final _that = this; +switch (_that) { +case _EspWifiAccessPoint() when $default != null: +return $default(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen(TResult Function( String ssid, int channel, EspWifiAccessPointSecurity security, int rssi)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _EspWifiAccessPoint() when $default != null: +return $default(_that.ssid,_that.channel,_that.security,_that.rssi);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when(TResult Function( String ssid, int channel, EspWifiAccessPointSecurity security, int rssi) $default,) {final _that = this; +switch (_that) { +case _EspWifiAccessPoint(): +return $default(_that.ssid,_that.channel,_that.security,_that.rssi);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String ssid, int channel, EspWifiAccessPointSecurity security, int rssi)? $default,) {final _that = this; +switch (_that) { +case _EspWifiAccessPoint() when $default != null: +return $default(_that.ssid,_that.channel,_that.security,_that.rssi);case _: + return null; + +} +} + } /// @nodoc @JsonSerializable() -class _$EspWifiAccessPointImpl with DiagnosticableTreeMixin implements _EspWifiAccessPoint { - const _$EspWifiAccessPointImpl( - {required this.ssid, required this.channel, required this.security, required this.rssi}); - - factory _$EspWifiAccessPointImpl.fromJson(Map json) => _$$EspWifiAccessPointImplFromJson(json); - - /// The SSID of the access point. - @override - final String ssid; - - /// The channel of the access point. On Android, channel is unsupported so the value is always 0. - @override - final int channel; - - /// The security configuration of the access point. - @override - final EspWifiAccessPointSecurity security; - - /// The Wi-Fi signal strength of the access point. - @override - final int rssi; - - @override - String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'EspWifiAccessPoint(ssid: $ssid, channel: $channel, security: $security, rssi: $rssi)'; - } - - @override - void debugFillProperties(DiagnosticPropertiesBuilder properties) { - super.debugFillProperties(properties); - properties - ..add(DiagnosticsProperty('type', 'EspWifiAccessPoint')) - ..add(DiagnosticsProperty('ssid', ssid)) - ..add(DiagnosticsProperty('channel', channel)) - ..add(DiagnosticsProperty('security', security)) - ..add(DiagnosticsProperty('rssi', rssi)); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$EspWifiAccessPointImpl && - (identical(other.ssid, ssid) || other.ssid == ssid) && - (identical(other.channel, channel) || other.channel == channel) && - (identical(other.security, security) || other.security == security) && - (identical(other.rssi, rssi) || other.rssi == rssi)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash(runtimeType, ssid, channel, security, rssi); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$EspWifiAccessPointImplCopyWith<_$EspWifiAccessPointImpl> get copyWith => - __$$EspWifiAccessPointImplCopyWithImpl<_$EspWifiAccessPointImpl>(this, _$identity); - - @override - Map toJson() { - return _$$EspWifiAccessPointImplToJson( - this, - ); - } -} - -abstract class _EspWifiAccessPoint implements EspWifiAccessPoint { - const factory _EspWifiAccessPoint( - {required final String ssid, - required final int channel, - required final EspWifiAccessPointSecurity security, - required final int rssi}) = _$EspWifiAccessPointImpl; - - factory _EspWifiAccessPoint.fromJson(Map json) = _$EspWifiAccessPointImpl.fromJson; - - @override - - /// The SSID of the access point. - String get ssid; - @override - - /// The channel of the access point. On Android, channel is unsupported so the value is always 0. - int get channel; - @override - - /// The security configuration of the access point. - EspWifiAccessPointSecurity get security; - @override - - /// The Wi-Fi signal strength of the access point. - int get rssi; - @override - @JsonKey(ignore: true) - _$$EspWifiAccessPointImplCopyWith<_$EspWifiAccessPointImpl> get copyWith => throw _privateConstructorUsedError; + +class _EspWifiAccessPoint with DiagnosticableTreeMixin implements EspWifiAccessPoint { + const _EspWifiAccessPoint({required this.ssid, required this.channel, required this.security, required this.rssi}); + factory _EspWifiAccessPoint.fromJson(Map json) => _$EspWifiAccessPointFromJson(json); + +/// The SSID of the access point. +@override final String ssid; +/// The channel of the access point. On Android, channel is unsupported so the value is always 0. +@override final int channel; +/// The security configuration of the access point. +@override final EspWifiAccessPointSecurity security; +/// The Wi-Fi signal strength of the access point. +@override final int rssi; + +/// Create a copy of EspWifiAccessPoint +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$EspWifiAccessPointCopyWith<_EspWifiAccessPoint> get copyWith => __$EspWifiAccessPointCopyWithImpl<_EspWifiAccessPoint>(this, _$identity); + +@override +Map toJson() { + return _$EspWifiAccessPointToJson(this, ); +} +@override +void debugFillProperties(DiagnosticPropertiesBuilder properties) { + properties + ..add(DiagnosticsProperty('type', 'EspWifiAccessPoint')) + ..add(DiagnosticsProperty('ssid', ssid))..add(DiagnosticsProperty('channel', channel))..add(DiagnosticsProperty('security', security))..add(DiagnosticsProperty('rssi', rssi)); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _EspWifiAccessPoint&&(identical(other.ssid, ssid) || other.ssid == ssid)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.security, security) || other.security == security)&&(identical(other.rssi, rssi) || other.rssi == rssi)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,ssid,channel,security,rssi); + +@override +String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) { + return 'EspWifiAccessPoint(ssid: $ssid, channel: $channel, security: $security, rssi: $rssi)'; +} + + +} + +/// @nodoc +abstract mixin class _$EspWifiAccessPointCopyWith<$Res> implements $EspWifiAccessPointCopyWith<$Res> { + factory _$EspWifiAccessPointCopyWith(_EspWifiAccessPoint value, $Res Function(_EspWifiAccessPoint) _then) = __$EspWifiAccessPointCopyWithImpl; +@override @useResult +$Res call({ + String ssid, int channel, EspWifiAccessPointSecurity security, int rssi +}); + + + + +} +/// @nodoc +class __$EspWifiAccessPointCopyWithImpl<$Res> + implements _$EspWifiAccessPointCopyWith<$Res> { + __$EspWifiAccessPointCopyWithImpl(this._self, this._then); + + final _EspWifiAccessPoint _self; + final $Res Function(_EspWifiAccessPoint) _then; + +/// Create a copy of EspWifiAccessPoint +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? ssid = null,Object? channel = null,Object? security = null,Object? rssi = null,}) { + return _then(_EspWifiAccessPoint( +ssid: null == ssid ? _self.ssid : ssid // ignore: cast_nullable_to_non_nullable +as String,channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable +as int,security: null == security ? _self.security : security // ignore: cast_nullable_to_non_nullable +as EspWifiAccessPointSecurity,rssi: null == rssi ? _self.rssi : rssi // ignore: cast_nullable_to_non_nullable +as int, + )); } + + +} + +// dart format on diff --git a/esp_provisioning/lib/src/esp_wifi_access_point.g.dart b/esp_provisioning/lib/src/esp_wifi_access_point.g.dart index 9b8a09a..3d1d825 100644 --- a/esp_provisioning/lib/src/esp_wifi_access_point.g.dart +++ b/esp_provisioning/lib/src/esp_wifi_access_point.g.dart @@ -6,14 +6,16 @@ part of 'esp_wifi_access_point.dart'; // JsonSerializableGenerator // ************************************************************************** -_$EspWifiAccessPointImpl _$$EspWifiAccessPointImplFromJson(Map json) => _$EspWifiAccessPointImpl( +_EspWifiAccessPoint _$EspWifiAccessPointFromJson(Map json) => + _EspWifiAccessPoint( ssid: json['ssid'] as String, - channel: json['channel'] as int, + channel: (json['channel'] as num).toInt(), security: EspWifiAccessPointSecurity.fromJson(json['security'] as String), - rssi: json['rssi'] as int, + rssi: (json['rssi'] as num).toInt(), ); -Map _$$EspWifiAccessPointImplToJson(_$EspWifiAccessPointImpl instance) => { +Map _$EspWifiAccessPointToJson(_EspWifiAccessPoint instance) => + { 'ssid': instance.ssid, 'channel': instance.channel, 'security': _$EspWifiAccessPointSecurityEnumMap[instance.security]!, diff --git a/esp_provisioning/pubspec.yaml b/esp_provisioning/pubspec.yaml index d5509b8..910f637 100644 --- a/esp_provisioning/pubspec.yaml +++ b/esp_provisioning/pubspec.yaml @@ -1,10 +1,10 @@ name: esp_provisioning description: SpinDance Flutter federated plugin; wraps Espressif's native mobile provisioning libraries. -version: 1.0.4 +version: 1.0.5 publish_to: none environment: - sdk: "^3.6.1" + sdk: "^3.8.0" flutter: plugin: @@ -23,17 +23,17 @@ dependencies: path: ../esp_provisioning_platform_interface flutter: sdk: flutter - freezed_annotation: ^2.4.4 - json_annotation: ^4.9.0 + freezed_annotation: ^3.1.0 + json_annotation: ^4.11.0 permission_handler: ^11.3.1 dev_dependencies: - build_runner: ^2.4.9 + build_runner: ^2.10.0 fake_async: ^1.3.1 flutter_test: sdk: flutter - freezed: ^2.5.7 - json_serializable: ^6.9.0 + freezed: ^3.2.5 + json_serializable: ^6.13.0 mocktail: ^1.0.3 plugin_platform_interface: ^2.1.8 very_good_analysis: ^7.0.0 diff --git a/esp_provisioning/test/esp_provisioning_test.dart b/esp_provisioning/test/esp_provisioning_test.dart index 8d37708..55fef6c 100644 --- a/esp_provisioning/test/esp_provisioning_test.dart +++ b/esp_provisioning/test/esp_provisioning_test.dart @@ -63,8 +63,9 @@ void main() { }); test('connect', () async { - when(() => espProvisioningPlatform.connectDevice(deviceA.name, serviceUuid, proofOfPossession)) - .thenAnswer((_) async {}); + when( + () => espProvisioningPlatform.connectDevice(deviceA.name, serviceUuid, proofOfPossession), + ).thenAnswer((_) async {}); await subject.connect(deviceA.name, proofOfPossession); verify(() => espProvisioningPlatform.connectDevice(deviceA.name, serviceUuid, proofOfPossession)).called(1); }); @@ -76,8 +77,9 @@ void main() { }); test('getAccessPoints', () async { - when(() => espProvisioningPlatform.getEspAccessPoints(deviceA.name)) - .thenAnswer((_) async => [accessPointJsonString]); + when( + () => espProvisioningPlatform.getEspAccessPoints(deviceA.name), + ).thenAnswer((_) async => [accessPointJsonString]); expect(await subject.getAccessPoints(deviceA.name), [ap]); verify(() => espProvisioningPlatform.getEspAccessPoints(deviceA.name)).called(1); }); diff --git a/esp_provisioning_android/android/build.gradle b/esp_provisioning_android/android/build.gradle index 0dcaf3a..be4adf1 100644 --- a/esp_provisioning_android/android/build.gradle +++ b/esp_provisioning_android/android/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - namespace "com.spindance.esp_provisioning_android" + namespace "com.spindance.esp_provisioning" compileSdk 31 compileOptions { @@ -47,8 +47,8 @@ android { buildTypes { release { - minifyEnabled true - consumerProguardFiles 'proguard-rules.pro' + minifyEnabled false + // consumerProguardFiles 'proguard-rules.pro' // removed for now } } } diff --git a/esp_provisioning_android/android/gradle/wrapper/gradle-wrapper.properties b/esp_provisioning_android/android/gradle/wrapper/gradle-wrapper.properties index ae04661..27313fb 100644 --- a/esp_provisioning_android/android/gradle/wrapper/gradle-wrapper.properties +++ b/esp_provisioning_android/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/esp_provisioning_android/android/src/main/AndroidManifest.xml b/esp_provisioning_android/android/src/main/AndroidManifest.xml index b173cd8..0fd6dad 100644 --- a/esp_provisioning_android/android/src/main/AndroidManifest.xml +++ b/esp_provisioning_android/android/src/main/AndroidManifest.xml @@ -1,3 +1,3 @@ - + + diff --git a/esp_provisioning_platform_interface/lib/esp_provisioning_platform_interface.dart b/esp_provisioning_platform_interface/lib/esp_provisioning_platform_interface.dart index 9902228..2072a0a 100644 --- a/esp_provisioning_platform_interface/lib/esp_provisioning_platform_interface.dart +++ b/esp_provisioning_platform_interface/lib/esp_provisioning_platform_interface.dart @@ -79,12 +79,12 @@ abstract class EspProvisioningPlatform extends PlatformInterface { /// Send [data] to the ESP device with the specified [deviceName] using the custom BLE endpoint indicated by /// [endpointPath]. Future sendData(String deviceName, String endpointPath, Uint8List data) async { - final base64StringResult = - await methodChannel.invokeMethod(PluginMethodNames.sendData, { - PluginArgumentNames.deviceName: deviceName, - PluginArgumentNames.endpointPath: endpointPath, - PluginArgumentNames.data: data, - }); + final base64StringResult = await methodChannel + .invokeMethod(PluginMethodNames.sendData, { + PluginArgumentNames.deviceName: deviceName, + PluginArgumentNames.endpointPath: endpointPath, + PluginArgumentNames.data: data, + }); if (base64StringResult == null) throw Exception('Unable to send data.'); return base64StringResult; } diff --git a/esp_provisioning_platform_interface/test/esp_provisioning_platform_interface_test.dart b/esp_provisioning_platform_interface/test/esp_provisioning_platform_interface_test.dart index 50ad466..8aef443 100644 --- a/esp_provisioning_platform_interface/test/esp_provisioning_platform_interface_test.dart +++ b/esp_provisioning_platform_interface/test/esp_provisioning_platform_interface_test.dart @@ -112,11 +112,7 @@ void main() { const password = 'Password'; await subject.setEspAccessPoint(deviceName, ssid, password); - final expectedArguments = { - 'deviceName': deviceName, - 'ssid': ssid, - 'password': password, - }; + final expectedArguments = {'deviceName': deviceName, 'ssid': ssid, 'password': password}; expect(log, [isMethodCall('setAccessPoint', arguments: expectedArguments)]); }); @@ -124,11 +120,7 @@ void main() { test('sendData', () async { await subject.sendData(deviceName, endpoint, data); - final expectedArguments = { - 'deviceName': deviceName, - 'endpointPath': endpoint, - 'data': data, - }; + final expectedArguments = {'deviceName': deviceName, 'endpointPath': endpoint, 'data': data}; expect(log, [isMethodCall('sendData', arguments: expectedArguments)]); });