Skip to content

Commit b40f0c6

Browse files
committed
guarded HomeWidget.setAppGroupId behind mobile platform check
HomeWidget.setAppGroupId is only available on iOS and Android. Calling it on macOS threw MissingPluginException, crashing the app before the UI could render. Added a Platform.isIOS || Platform.isAndroid guard so the call is skipped on macOS and other desktop platforms.
1 parent 0f2ef75 commit b40f0c6

File tree

3 files changed

+85
-31
lines changed

3 files changed

+85
-31
lines changed

lib/app/utils/app_settings/app_settings.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:io';
2+
13
import 'package:get/get.dart';
24
import 'package:home_widget/home_widget.dart';
35
import 'package:shared_preferences/shared_preferences.dart';
@@ -14,7 +16,9 @@ class AppSettings {
1416
static final RxBool use24HourFormatRx = false.obs;
1517

1618
static Future init() async {
17-
await HomeWidget.setAppGroupId("group.taskwarrior");
19+
if (Platform.isIOS || Platform.isAndroid) {
20+
await HomeWidget.setAppGroupId("group.taskwarrior");
21+
}
1822
await SelectedTheme.init();
1923
await SelectedLanguage.init();
2024
await SaveTourStatus.init();

macos/Flutter/GeneratedPluginRegistrant.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import FlutterMacOS
66
import Foundation
77

8+
import app_links
89
import connectivity_plus
910
import file_picker
1011
import file_picker_writable
@@ -18,6 +19,7 @@ import sqflite_darwin
1819
import url_launcher_macos
1920

2021
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
22+
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
2123
ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
2224
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
2325
FilePickerWritablePlugin.register(with: registry.registrar(forPlugin: "FilePickerWritablePlugin"))

pubspec.lock

Lines changed: 78 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ packages:
55
dependency: transitive
66
description:
77
name: _fe_analyzer_shared
8-
sha256: da0d9209ca76bde579f2da330aeb9df62b6319c834fa7baae052021b0462401f
8+
sha256: c209688d9f5a5f26b2fb47a188131a6fb9e876ae9e47af3737c0b4f58a93470d
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "85.0.0"
11+
version: "91.0.0"
1212
analyzer:
1313
dependency: transitive
1414
description:
1515
name: analyzer
16-
sha256: "974859dc0ff5f37bc4313244b3218c791810d03ab3470a579580279ba971a48d"
16+
sha256: f51c8499b35f9b26820cfe914828a6a98a94efd5cc78b37bb7d03debae3a1d08
1717
url: "https://pub.dev"
1818
source: hosted
19-
version: "7.7.1"
19+
version: "8.4.1"
2020
ansicolor:
2121
dependency: transitive
2222
description:
@@ -25,6 +25,38 @@ packages:
2525
url: "https://pub.dev"
2626
source: hosted
2727
version: "2.0.3"
28+
app_links:
29+
dependency: "direct main"
30+
description:
31+
name: app_links
32+
sha256: "5f88447519add627fe1cbcab4fd1da3d4fed15b9baf29f28b22535c95ecee3e8"
33+
url: "https://pub.dev"
34+
source: hosted
35+
version: "6.4.1"
36+
app_links_linux:
37+
dependency: transitive
38+
description:
39+
name: app_links_linux
40+
sha256: f5f7173a78609f3dfd4c2ff2c95bd559ab43c80a87dc6a095921d96c05688c81
41+
url: "https://pub.dev"
42+
source: hosted
43+
version: "1.0.3"
44+
app_links_platform_interface:
45+
dependency: transitive
46+
description:
47+
name: app_links_platform_interface
48+
sha256: "05f5379577c513b534a29ddea68176a4d4802c46180ee8e2e966257158772a3f"
49+
url: "https://pub.dev"
50+
source: hosted
51+
version: "2.0.2"
52+
app_links_web:
53+
dependency: transitive
54+
description:
55+
name: app_links_web
56+
sha256: af060ed76183f9e2b87510a9480e56a5352b6c249778d07bd2c95fc35632a555
57+
url: "https://pub.dev"
58+
source: hosted
59+
version: "1.0.4"
2860
archive:
2961
dependency: transitive
3062
description:
@@ -65,6 +97,14 @@ packages:
6597
url: "https://pub.dev"
6698
source: hosted
6799
version: "3.1.0"
100+
build_cli_annotations:
101+
dependency: transitive
102+
description:
103+
name: build_cli_annotations
104+
sha256: e563c2e01de8974566a1998410d3f6f03521788160a02503b0b1f1a46c7b3d95
105+
url: "https://pub.dev"
106+
source: hosted
107+
version: "2.1.1"
68108
build_config:
69109
dependency: transitive
70110
description:
@@ -125,10 +165,10 @@ packages:
125165
dependency: transitive
126166
description:
127167
name: characters
128-
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
168+
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
129169
url: "https://pub.dev"
130170
source: hosted
131-
version: "1.4.0"
171+
version: "1.4.1"
132172
checked_yaml:
133173
dependency: transitive
134174
description:
@@ -253,10 +293,10 @@ packages:
253293
dependency: transitive
254294
description:
255295
name: dart_style
256-
sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb"
296+
sha256: a9c30492da18ff84efe2422ba2d319a89942d93e58eb0b73d32abe822ef54b7b
257297
url: "https://pub.dev"
258298
source: hosted
259-
version: "3.1.1"
299+
version: "3.1.3"
260300
dartx:
261301
dependency: transitive
262302
description:
@@ -519,6 +559,14 @@ packages:
519559
url: "https://pub.dev"
520560
source: hosted
521561
version: "2.0.32"
562+
flutter_rust_bridge:
563+
dependency: "direct main"
564+
description:
565+
name: flutter_rust_bridge
566+
sha256: "37ef40bc6f863652e865f0b2563ea07f0d3c58d8efad803cc01933a4b2ee067e"
567+
url: "https://pub.dev"
568+
source: hosted
569+
version: "2.11.1"
522570
flutter_slidable:
523571
dependency: "direct main"
524572
description:
@@ -601,6 +649,14 @@ packages:
601649
url: "https://pub.dev"
602650
source: hosted
603651
version: "2.3.2"
652+
gtk:
653+
dependency: transitive
654+
description:
655+
name: gtk
656+
sha256: e8ce9ca4b1df106e4d72dad201d345ea1a036cc12c360f1a7d5a758f78ffa42c
657+
url: "https://pub.dev"
658+
source: hosted
659+
version: "2.1.0"
604660
hashcodes:
605661
dependency: transitive
606662
description:
@@ -721,14 +777,6 @@ packages:
721777
url: "https://pub.dev"
722778
source: hosted
723779
version: "1.0.5"
724-
js:
725-
dependency: transitive
726-
description:
727-
name: js
728-
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
729-
url: "https://pub.dev"
730-
source: hosted
731-
version: "0.6.7"
732780
json_annotation:
733781
dependency: transitive
734782
description:
@@ -797,18 +845,18 @@ packages:
797845
dependency: transitive
798846
description:
799847
name: matcher
800-
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
848+
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6"
801849
url: "https://pub.dev"
802850
source: hosted
803-
version: "0.12.17"
851+
version: "0.12.18"
804852
material_color_utilities:
805853
dependency: transitive
806854
description:
807855
name: material_color_utilities
808-
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
856+
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
809857
url: "https://pub.dev"
810858
source: hosted
811-
version: "0.11.1"
859+
version: "0.13.0"
812860
meta:
813861
dependency: transitive
814862
description:
@@ -829,10 +877,10 @@ packages:
829877
dependency: "direct main"
830878
description:
831879
name: mockito
832-
sha256: "2314cbe9165bcd16106513df9cf3c3224713087f09723b128928dc11a4379f99"
880+
sha256: a45d1aa065b796922db7b9e7e7e45f921aed17adf3a8318a1f47097e7e695566
833881
url: "https://pub.dev"
834882
source: hosted
835-
version: "5.5.0"
883+
version: "5.6.3"
836884
nm:
837885
dependency: transitive
838886
description:
@@ -1141,10 +1189,10 @@ packages:
11411189
dependency: transitive
11421190
description:
11431191
name: shelf_web_socket
1144-
sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
1192+
sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925"
11451193
url: "https://pub.dev"
11461194
source: hosted
1147-
version: "1.0.4"
1195+
version: "3.0.0"
11481196
sizer:
11491197
dependency: "direct main"
11501198
description:
@@ -1330,26 +1378,26 @@ packages:
13301378
dependency: "direct main"
13311379
description:
13321380
name: test
1333-
sha256: "75906bf273541b676716d1ca7627a17e4c4070a3a16272b7a3dc7da3b9f3f6b7"
1381+
sha256: "54c516bbb7cee2754d327ad4fca637f78abfc3cbcc5ace83b3eda117e42cd71a"
13341382
url: "https://pub.dev"
13351383
source: hosted
1336-
version: "1.26.3"
1384+
version: "1.29.0"
13371385
test_api:
13381386
dependency: transitive
13391387
description:
13401388
name: test_api
1341-
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
1389+
sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636"
13421390
url: "https://pub.dev"
13431391
source: hosted
1344-
version: "0.7.7"
1392+
version: "0.7.9"
13451393
test_core:
13461394
dependency: transitive
13471395
description:
13481396
name: test_core
1349-
sha256: "0cc24b5ff94b38d2ae73e1eb43cc302b77964fbf67abad1e296025b78deb53d0"
1397+
sha256: "394f07d21f0f2255ec9e3989f21e54d3c7dc0e6e9dbce160e5a9c1a6be0e2943"
13501398
url: "https://pub.dev"
13511399
source: hosted
1352-
version: "0.6.12"
1400+
version: "0.6.15"
13531401
textfield_tags:
13541402
dependency: "direct main"
13551403
description:

0 commit comments

Comments
 (0)