Repository navigation
network_info_plus_watchos 0.1.1: upstream's example, its location request answered - #41
Conversation
…uest answered The follow-up flutterwatch#11 announced. Upstream's example asks permission_handler for location at start, behind Platform.isIOS, which is true on the watch. With permission_handler_watchos in this repository that request has an answer, so the FlutterWatchosPlatform.isIos guard, a watch deviation AUTHORING §3 allows only while the plugin has no watchOS implementation, is gone: * example/lib/main.dart is network_info_plus 8.2.2's own, unchanged. * example/pubspec.yaml adds permission_handler_watchos (by path; it is staged, not yet on pub.dev) in place of flutter_watchos, and names permission_handler ^13.0.2, as upstream's example does. * The Info.plist has upstream's NSLocationWhenInUseUsageDescription, "Obtain WIFI Name", which the prompt shows and which, with the next flutter-watchos release, compiles in permission_handler_watchos's location group alone. * The runner installs FlutterWatchOSAppDelegate, as the current `flutter-watchos create` template does; the CLI warned that permission_handler_watchos's notification group needs it. * The start test checks a start without an error, then the network info, which waits for the location prompt: it is skipped on a fresh install with no one to answer, unless the run passes --dart-define=NIP_PROMPT=true, and runs at once when location was answered before. * README's "Example deviations", PORTING_REPORT, the content-scale test's comment and the root README (the example no longer starts with an error) follow. Checked on the watchOS 27.0 Simulator (Apple Watch Series 12, 46 mm): no exception and no overflow in the first 15 seconds, the location prompt with upstream's text, the network info once allowed; upstream's network_info_plus_test.dart; the start test with location answered before (passed), answered during the run (passed) and unanswered (skipped); the 7 widget tests, the content-scale check on every watch size included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MAUstaoglu
left a comment
There was a problem hiding this comment.
Thank you @iamoguzhanarslantas for this, and I am sorry it waited two weeks for a review.
I read the diff and I have no blocking comments. The example is upstream's again, the dependency and the Info.plist key match what permission_handler_watchos expects, the runner has the same FlutterWatchOSAppDelegate block as the 0.2.0 template, the 0.1.1 bump and changelog are what the version check needs, and the checks are green on a branch that is level with main.
Two small things, neither blocking:
- In
watchos_example_start_test.darttheelapsedstopwatch started at line 45 also measures the wait at line 62, so the 3-second startup pump counts againstlimit. With location already answered the test now waits 7 seconds after startup rather than the 10 the old test allowed. A second stopwatch before the wait, orlimit + 3 s, would keep the old budget. permission_handler_watchosis not on pub.dev yet, so the example's path dependency cannot be fetched from a published 0.1.1. I will hold the publish until that package is out. Merging is not affected.
The PR description says "the next flutter-watchos release" for per-app defines; they shipped in 0.1.2, and 0.2.0 is out now. Nothing in the files needs changing for that.
I have not run the example myself yet. Thanks for the careful write-up of what was and was not verified.
Summary
The follow-up announced in #11.
network_info_plus_watchos's example askspermission_handlerfor location at start, behindPlatform.isIOS, which is true on the watch. Until now the example guarded that call withFlutterWatchosPlatform.isIos, becausepermission_handlerhad no watchOS implementation. Now thatpermission_handler_watchosis in this repository, the request has an answer, so the example is upstream's again (AUTHORING.md §3).example/lib/main.dartis network_info_plus 8.2.2's own example, unchanged.example/pubspec.yamladdspermission_handler_watchosby path, in place offlutter_watchos. It namespermission_handler: ^13.0.2, as upstream's example does.example/watchos/Runner/Info.plisthas upstream'sNSLocationWhenInUseUsageDescription("Obtain WIFI Name"). With the next flutter-watchos release, this key alone compiles inpermission_handler_watchos's location group (permission_handler_watchos: compile in only the permission groups an app uses #39).FlutterWatchOSAppDelegate, as the currentflutter-watchos createtemplate does. Without it, the CLI warned thatpermission_handler_watchos's notification group needs it.watchos_example_start_test.dartchecks a start without an error, then the network info. The network info waits for the location prompt, so:--dart-define=NIP_PROMPT=true, it waits up to a minute for someone to answer.Verified
On the watchOS 27.0 Simulator (Apple Watch Series 12, 46 mm), run with
flutter.inspector.structuredErrors=false:network_info_plus_test.dartpasses.On the host:
tool/check,dart formatas CI runs it,pub publish --dry-runandtool/check_native_sources.sh(Xcode 27.1) are clean.Not verified
Notes for review
permission_handler_watchosis staged at 0.0.1 and not on pub.dev yet, so the example depends on it by path. The published 0.1.1 would carry an example whose permission package someone outside this repository cannot fetch yet. If you'd rather keep the guard untilpermission_handler_watchosis published (permission_handler_watchos: App Review proof and compile-time opt-in before 0.1.0 #19), this can wait until then.🤖 Generated with Claude Code