diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 6f22625d..e66070d2 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -26,7 +26,7 @@ jobs:
- name: Analyze
run: flutter analyze
- name: Format
- run: flutter format . --set-exit-if-changed
+ run: dart format . --set-exit-if-changed
- name: Publishability
run: flutter pub publish --dry-run
- name: Test
diff --git a/android/build.gradle b/android/build.gradle
index 96c4d0ce..5b949455 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -2,14 +2,14 @@ group 'es.antonborri.home_widget'
version '1.0-SNAPSHOT'
buildscript {
- ext.kotlin_version = '1.5.10'
+ ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.0.3'
+ classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
- compileSdkVersion 31
+ compileSdkVersion 33
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@@ -39,5 +39,5 @@ android {
}
dependencies {
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index e6be4944..a2f65472 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 31
+ compileSdkVersion 33
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@@ -40,7 +40,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "es.antonborri.home_widget_example"
minSdkVersion 16
- targetSdkVersion 31
+ targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
diff --git a/example/android/build.gradle b/example/android/build.gradle
index aa3c56b8..e269d914 100644
--- a/example/android/build.gradle
+++ b/example/android/build.gradle
@@ -1,12 +1,12 @@
buildscript {
- ext.kotlin_version = '1.5.20'
+ ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
}
dependencies {
- classpath "com.android.tools.build:gradle:7.0.3"
+ classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}
-task clean(type: Delete) {
+tasks.register("clean", Delete) {
delete rootProject.buildDir
}
diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties
index 32838d86..c13b6c23 100644
--- a/example/android/gradle/wrapper/gradle-wrapper.properties
+++ b/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Sat Nov 20 22:03:31 CET 2021
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
diff --git a/example/integration_test/android_test.dart b/example/integration_test/android_test.dart
index 571f2584..298a053d 100644
--- a/example/integration_test/android_test.dart
+++ b/example/integration_test/android_test.dart
@@ -71,4 +71,4 @@ void main() {
});
}
-void backgroundCallback(Uri uri) {}
+void backgroundCallback(Uri? uri) {}
diff --git a/example/integration_test/ios_test.dart b/example/integration_test/ios_test.dart
index 72b01eac..d2297751 100644
--- a/example/integration_test/ios_test.dart
+++ b/example/integration_test/ios_test.dart
@@ -93,4 +93,4 @@ void main() {
});
}
-void backgroundCallback(Uri uri) {}
+void backgroundCallback(Uri? uri) {}
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 496c3861..5c72903b 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 51;
+ objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -292,10 +292,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
@@ -323,6 +325,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist
index b04f7107..654a338f 100644
--- a/example/ios/Runner/Info.plist
+++ b/example/ios/Runner/Info.plist
@@ -47,5 +47,7 @@
CADisableMinimumFrameDurationOnPhone
+ UIApplicationSupportsIndirectInputEvents
+
diff --git a/example/lib/main.dart b/example/lib/main.dart
index f9a2eabf..cc93f768 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -13,7 +13,7 @@ import 'package:workmanager/workmanager.dart';
void callbackDispatcher() {
Workmanager().executeTask((taskName, inputData) {
final now = DateTime.now();
- return Future.wait([
+ return Future.wait([
HomeWidget.saveWidgetData(
'title',
'Updated from Background',
@@ -34,10 +34,10 @@ void callbackDispatcher() {
/// Called when Doing Background Work initiated from Widget
@pragma("vm:entry-point")
-void backgroundCallback(Uri data) async {
+void backgroundCallback(Uri? data) async {
print(data);
- if (data.host == 'titleclicked') {
+ if (data?.host == 'titleclicked') {
final greetings = [
'Hello',
'Hallo',
@@ -92,7 +92,7 @@ class _MyAppState extends State {
super.dispose();
}
- Future _sendData() async {
+ Future _sendData() async {
try {
return Future.wait([
HomeWidget.saveWidgetData('title', _titleController.text),
@@ -103,7 +103,7 @@ class _MyAppState extends State {
}
}
- Future _updateWidget() async {
+ Future _updateWidget() async {
try {
return HomeWidget.updateWidget(
name: 'HomeWidgetExampleProvider', iOSName: 'HomeWidgetExample');
@@ -112,14 +112,14 @@ class _MyAppState extends State {
}
}
- Future _loadData() async {
+ Future _loadData() async {
try {
return Future.wait([
HomeWidget.getWidgetData('title', defaultValue: 'Default Title')
- .then((value) => _titleController.text = value),
+ .then((value) => _titleController.text = value ?? ''),
HomeWidget.getWidgetData('message',
defaultValue: 'Default Message')
- .then((value) => _messageController.text = value),
+ .then((value) => _messageController.text = value ?? ''),
]);
} on PlatformException catch (exception) {
debugPrint('Error Getting Data. $exception');
@@ -135,7 +135,7 @@ class _MyAppState extends State {
HomeWidget.initiallyLaunchedFromHomeWidget().then(_launchedFromWidget);
}
- void _launchedFromWidget(Uri uri) {
+ void _launchedFromWidget(Uri? uri) {
if (uri != null) {
showDialog(
context: context,
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 42c12224..4e9dabb9 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -4,7 +4,7 @@ description: Demonstrates how to use the home_widget plugin.
publish_to: 'none'
environment:
- sdk: ">=2.7.0 <3.0.0"
+ sdk: ">=2.12.0 <4.0.0"
dependencies:
flutter:
@@ -17,7 +17,7 @@ dependencies:
home_widget:
path: ../
- cupertino_icons: ^0.1.3
+ cupertino_icons: ^1.0.5
dev_dependencies:
integration_test:
diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart
deleted file mode 100644
index 7017a1d6..00000000
--- a/example/test/widget_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// This is a basic Flutter widget test.
-//
-// To perform an interaction with a widget in your test, use the WidgetTester
-// utility that Flutter provides. For example, you can send tap and scroll
-// gestures. You can also use WidgetTester to find child widgets in the widget
-// tree, read text, and verify that the values of widget properties are correct.
-
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-
-import 'package:home_widget_example/main.dart';
-
-void main() {
- testWidgets('Verify Platform version', (WidgetTester tester) async {
- // Build our app and trigger a frame.
- await tester.pumpWidget(MyApp());
-
- // Verify that platform version is retrieved.
- expect(
- find.byWidgetPredicate(
- (Widget widget) =>
- widget is Text && widget.data.startsWith('Running on:'),
- ),
- findsOneWidget,
- );
- });
-}
diff --git a/lib/home_widget_callback_dispatcher.dart b/lib/home_widget_callback_dispatcher.dart
index 8046b9d1..9ea4be5d 100644
--- a/lib/home_widget_callback_dispatcher.dart
+++ b/lib/home_widget_callback_dispatcher.dart
@@ -6,10 +6,10 @@ import 'package:flutter/services.dart';
/// Dispatcher used for calling dart code from Native Code while in the background
@pragma("vm:entry-point")
void callbackDispatcher() {
- const _backgroundChannel = MethodChannel('home_widget/background');
+ const backgroundChannel = MethodChannel('home_widget/background');
WidgetsFlutterBinding.ensureInitialized();
- _backgroundChannel.setMethodCallHandler((call) async {
+ backgroundChannel.setMethodCallHandler((call) async {
final args = call.arguments;
final callback = PluginUtilities.getCallbackFromHandle(
@@ -23,5 +23,5 @@ void callbackDispatcher() {
callback?.call(uri);
});
- _backgroundChannel.invokeMethod('HomeWidget.backgroundInitialized');
+ backgroundChannel.invokeMethod('HomeWidget.backgroundInitialized');
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 5beb0118..1c544540 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -4,7 +4,7 @@ version: 0.2.0+1
repository: https://github.com/ABausG/home_widget
environment:
- sdk: '>=2.12.0 <3.0.0'
+ sdk: '>=2.12.0 <4.0.0'
flutter: ">=1.17.0"
dependencies:
@@ -14,7 +14,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
- flutter_lints: ^1.0.4
+ flutter_lints: ^2.0.1
flutter:
plugin:
diff --git a/test/background_test.dart b/test/background_test.dart
index 1f04b027..89d7ed25 100644
--- a/test/background_test.dart
+++ b/test/background_test.dart
@@ -14,10 +14,12 @@ void main() {
PluginUtilities.getCallbackHandle(testCallback)?.toRawHandle();
const testUri = 'homeWidget://homeWidgetTest';
- // ignore: body_might_complete_normally_nullable
- backgroundChannel.setMockMethodCallHandler((call) {
+ tester.binding.defaultBinaryMessenger
+ // ignore: body_might_complete_normally_nullable
+ .setMockMethodCallHandler(backgroundChannel, (call) {
if (call.method == 'HomeWidget.backgroundInitialized') {
emitEvent(
+ tester,
backgroundChannel.codec
.encodeMethodCall(MethodCall('', [callbackHandle, testUri])),
);
@@ -32,8 +34,8 @@ void main() {
});
}
-void emitEvent(ByteData? event) {
- backgroundChannel.binaryMessenger.handlePlatformMessage(
+void emitEvent(WidgetTester tester, ByteData? event) {
+ tester.binding.defaultBinaryMessenger.handlePlatformMessage(
backgroundChannel.name,
event,
(ByteData? reply) {},
diff --git a/test/home_widget_test.dart b/test/home_widget_test.dart
index b2e87851..4fa14eee 100644
--- a/test/home_widget_test.dart
+++ b/test/home_widget_test.dart
@@ -21,7 +21,9 @@ void main() {
setUp(() {
launchUri = null;
passedArguments = Completer();
- channel.setMockMethodCallHandler((MethodCall methodCall) async {
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
+ // ignore: body_might_complete_normally_nullable
+ .setMockMethodCallHandler(channel, (MethodCall methodCall) async {
passedArguments.complete(methodCall.arguments);
switch (methodCall.method) {
case 'saveWidgetData':
@@ -41,7 +43,8 @@ void main() {
});
tearDown(() {
- channel.setMockMethodCallHandler(null);
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
+ .setMockMethodCallHandler(channel, null);
});
test('getWidgetData', () async {
@@ -140,9 +143,10 @@ void main() {
group('Widget Clicked', () {
test('Send Uris to Stream', () async {
- updateChannel.binaryMessenger.setMockMessageHandler(updateChannel.name,
- // ignore: body_might_complete_normally_nullable
- (message) async {
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
+ .setMockMessageHandler(updateChannel.name,
+ // ignore: body_might_complete_normally_nullable
+ (message) async {
emitEvent(
updateChannel.codec
.encodeSuccessEnvelope('homeWidget://homeWidgetTest'),
@@ -166,7 +170,8 @@ void main() {
}
void emitEvent(ByteData? event) {
- updateChannel.binaryMessenger.handlePlatformMessage(
+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
+ .handlePlatformMessage(
updateChannel.name,
event,
(ByteData? reply) {},