diff --git a/CHANGELOG.md b/CHANGELOG.md index 10335ae..30b6c76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -## 0.0.3 +## 0.0.4 -* Add isSupportCustomSim method which to know the device can set Custom Sim Slot or not. +* Migrated null safety diff --git a/README.md b/README.md index 21c942b..9a99712 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,6 @@ You can send SMS from foreground, background, and headless. It only support Android for now. -## Getting Started - -For help getting started with Flutter, view our online -[documentation](https://flutter.io/). - -For help on editing plugin code, view the [documentation](https://flutter.io/platform-plugins/#edit-code). - ## Installation and Usage Add `background_sms` to the dependencies list @@ -92,6 +85,11 @@ You can check Custom Sim Slot is support from Native Android. } ``` +## Platform Detail +Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git +Framework • revision 77d935af4d (2 months ago) • 2021-12-16 08:37:33 -0800 +Engine • revision 890a5fca2e +Tools • Dart 2.15.1 ### Created by [Shine Wanna](https://github.com/shinewanna) diff --git a/example/lib/main.dart b/example/lib/main.dart index 360a225..0a26df3 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -20,7 +20,7 @@ class _MyAppState extends State { Future _isPermissionGranted() async => await Permission.sms.status.isGranted; - _sendMessage(String phoneNumber, String message, {int simSlot}) async { + _sendMessage(String phoneNumber, String message, {int? simSlot}) async { var result = await BackgroundSms.sendMessage( phoneNumber: phoneNumber, message: message, simSlot: simSlot); if (result == SmsStatus.sent) { @@ -30,7 +30,7 @@ class _MyAppState extends State { } } - Future get _supportCustomSim async => + Future get _supportCustomSim async => await BackgroundSms.isSupportCustomSim; @override @@ -44,7 +44,7 @@ class _MyAppState extends State { child: Icon(Icons.send), onPressed: () async { if (await _isPermissionGranted()) { - if (await _supportCustomSim) + if ((await _supportCustomSim)!) _sendMessage("09xxxxxxxxx", "Hello", simSlot: 1); else _sendMessage("09xxxxxxxxx", "Hello"); diff --git a/example/pubspec.lock b/example/pubspec.lock index 2a1f508..d59a29d 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,63 +7,63 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.2" + version: "2.8.2" background_sms: dependency: "direct main" description: path: ".." relative: true source: path - version: "0.0.3" + version: "0.0.4" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.2.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.3.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.0.4" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -80,42 +80,63 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.8" + version: "0.12.11" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.7.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" permission_handler: dependency: "direct main" description: name: permission_handler url: "https://pub.dartlang.org" source: hosted - version: "5.0.1+1" + version: "9.2.0" + permission_handler_android: + dependency: transitive + description: + name: permission_handler_android + url: "https://pub.dartlang.org" + source: hosted + version: "9.0.2" + permission_handler_apple: + dependency: transitive + description: + name: permission_handler_apple + url: "https://pub.dartlang.org" + source: hosted + version: "9.0.2" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "3.7.0" + permission_handler_windows: + dependency: transitive + description: + name: permission_handler_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "2.1.2" sky_engine: dependency: transitive description: flutter @@ -127,56 +148,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.5" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.17" + version: "0.4.3" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.1" sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" - flutter: ">=1.20.0 <2.0.0" + dart: ">=2.15.0 <3.0.0" + flutter: ">=2.8.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 821f7a1..83c7423 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -6,7 +6,7 @@ description: The main purpose is to send sms from background and headless.You ca publish_to: 'none' # Remove this line if you wish to publish to pub.dev environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: @@ -22,8 +22,8 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.3 - permission_handler: ^5.0.1+1 + cupertino_icons: ^1.0.4 + permission_handler: ^9.2.0 dev_dependencies: flutter_test: diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index f54bac8..5c14a60 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -18,8 +18,8 @@ void main() { // Verify that platform version is retrieved. expect( find.byWidgetPredicate( - (Widget widget) => widget is Text && - widget.data.startsWith('Running on:'), + (Widget widget) => + widget is Text && widget.data!.startsWith('Running on:'), ), findsOneWidget, ); diff --git a/lib/background_sms.dart b/lib/background_sms.dart index 5daaa2a..9305853 100644 --- a/lib/background_sms.dart +++ b/lib/background_sms.dart @@ -8,9 +8,11 @@ class BackgroundSms { static const MethodChannel _channel = const MethodChannel('background_sms'); static Future sendMessage( - {String phoneNumber, String message, int simSlot}) async { + {required String phoneNumber, + required String message, + int? simSlot}) async { try { - String result = await _channel.invokeMethod('sendSms', { + String? result = await _channel.invokeMethod('sendSms', { "phone": phoneNumber, "msg": message, "simSlot": simSlot @@ -22,7 +24,7 @@ class BackgroundSms { } } - static Future get isSupportCustomSim async { + static Future get isSupportCustomSim async { try { return await _channel.invokeMethod('isSupportMultiSim'); } on PlatformException catch (e) { diff --git a/pubspec.lock b/pubspec.lock index 24007b6..bf25015 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,49 +7,49 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.2" + version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.2.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.3.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -66,21 +66,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.8" + version: "0.12.11" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.7.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -92,56 +92,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.5" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.17" + version: "0.4.3" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.1" sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" - flutter: ">=1.20.0 <2.0.0" + dart: ">=2.14.0 <3.0.0" + flutter: ">=1.20.0" diff --git a/pubspec.yaml b/pubspec.yaml index d358ff9..a8d671b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: background_sms description: The main purpose is to send sms from background and headless.You can send sms whatever the phone state is in app or background or headless. -version: 0.0.3 +version: 0.0.4 homepage: https://github.com/shinewanna/BackgroundSmsPlugin environment: - sdk: ">=2.7.0 <3.0.0" - flutter: ">=1.20.0 <2.0.0" + sdk: '>=2.12.0 <3.0.0' + flutter: ">=1.20.0" dependencies: flutter: