Skip to content

feat: Support UIScene Lifecyle#423

Open
ABausG wants to merge 2 commits into
mainfrom
feat/support-UI-Scene
Open

feat: Support UIScene Lifecyle#423
ABausG wants to merge 2 commits into
mainfrom
feat/support-UI-Scene

Conversation

@ABausG
Copy link
Copy Markdown
Owner

@ABausG ABausG commented May 25, 2026

Description

Migrating to support UIScene Lifecycle

Checklist

  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation and added code (documentation) comments where necessary.
  • I have updated/added relevant examples in example or documentation.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

@docs-page
Copy link
Copy Markdown

docs-page Bot commented May 25, 2026

To view this pull requests documentation preview, visit the following URL:

docs.page/abausg/home_widget~423

Documentation is deployed and generated using docs.page.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Review Change Stack

Walkthrough

This PR upgrades Flutter/Dart SDK constraints, migrates iOS apps to implicit engine delegates with new scene lifecycle support, integrates FlutterGeneratedPluginSwiftPackage across Xcode builds, and refactors code formatting throughout examples and tests.

Changes

iOS Plugin Architecture and Build System Migration

Layer / File(s) Summary
SDK Version Constraint Updates
pubspec.yaml, examples/*/pubspec.yaml, packages/home_widget/pubspec.yaml
Dart SDK minimum raised to 3.10.0 and Flutter minimum set to 3.38.1 across all environment configurations.
Plugin Registration Architecture in AppDelegate
examples/file_and_images/ios/Runner/AppDelegate.swift, examples/lockscreen_widgets/ios/Runner/AppDelegate.swift
AppDelegate now conforms to FlutterImplicitEngineDelegate; plugin registration moved from application(_:didFinishLaunchingWithOptions:) to new didInitializeImplicitFlutterEngine(_:) delegate callback.
HomeWidgetPlugin Scene Lifecycle and URL Handling
packages/home_widget/ios/home_widget/Sources/home_widget/HomeWidgetPlugin.swift
HomeWidgetPlugin conforms to FlutterSceneLifeCycleDelegate; registration logic guards against app extensions using runtime selectors; new scene delegate methods detect widget URLs from scene connection and open contexts.
iOS Plist Framework Configuration
examples/*/ios/Flutter/AppFrameworkInfo.plist, examples/file_and_images/ios/Runner/Info.plist, examples/lockscreen_widgets/ios/Runner/Info.plist
MinimumOSVersion removed from AppFrameworkInfo.plist across examples; CADisableMinimumFrameDurationOnPhone and UIApplicationSceneManifest added to Info.plist with single UIWindowScene using FlutterSceneDelegate.
Xcode Project Swift Package Integration
examples/*/ios/Runner.xcodeproj/project.pbxproj, packages/home_widget/example/ios/Runner.xcodeproj/project.pbxproj
FlutterGeneratedPluginSwiftPackage integrated: adds PBXBuildFile, PBXFileReference, and PBXFrameworksBuildPhase entries; wires package into Runner target dependencies; removes CocoaPods embed phases; adds XCLocalSwiftPackageReference sections.
Xcode Scheme Build Preparation
examples/*/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme, packages/home_widget/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
PreActions block added to Runner.xcscheme that executes Flutter xcode_backend.sh prepare before build for all example apps.

Code Formatting and Test Updates

Layer / File(s) Summary
Example App Dart Formatting
examples/configurable_widget/lib/android_configuration_page.dart, examples/configurable_widget/lib/main.dart, packages/home_widget/example/lib/main.dart
Dart formatting refactors in android_configuration_page.dart ternary and widget layout; main.dart method calls and widget construction reformatted for readability.
HomeWidget Library Formatting and Configuration
packages/home_widget/lib/src/home_widget.dart, packages/home_widget/lib/src/home_widget_callback_dispatcher.dart, packages/home_widget/lib/src/home_widget_info.dart
Library Dart files reformatted: method calls and image rendering pipeline in home_widget.dart, callback resolution in home_widget_callback_dispatcher.dart, configuration map filtering with non-String key removal in home_widget_info.dart.
Integration Test Formatting
packages/home_widget/example/integration_test/android_test.dart, packages/home_widget/example/integration_test/ios_test.dart
Integration tests reformatted: testWidgets signatures, data map literals, and call argument line wrapping adjusted for consistency.
Unit Test Improvements and Refactoring
packages/home_widget/test/background_test.dart, packages/home_widget/test/home_widget_test.dart
background_test.dart refactored for callbackHandle computation; home_widget_test.dart adds new test verifying error propagation when getWidgetData throws, reformats mock setup for file/image operations, and restructures async test patterns.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • ABausG/home_widget#411: Introduces the configurable_widget example app; this PR applies formatting/logic-preserving refactors to the same example code files.
🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is minimal with only 'Migrating to support UIScene Lifecycle' and all checklist items are unchecked, including tests, documentation, and examples. Provide a detailed description of the changes, explain what was modified and why, and check or mark checklist items as applicable (e.g., mark as [-] if not applicable).
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'feat: Support UIScene Lifecyle' is mostly related to the main changes, but contains a typo ('Lifecyle' should be 'Lifecycle') and is somewhat vague about the scope of the changes. Consider fixing the typo to 'feat: Support UIScene Lifecycle' for clarity and to ensure the title accurately reflects the changeset.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/support-UI-Scene

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7fe0741) to head (0cf05a7).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #423   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines          175       174    -1     
=========================================
- Hits           175       174    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/home_widget/example/ios/Runner.xcodeproj/project.pbxproj (1)

297-307: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove the leftover [CP] Embed Pods Frameworks build phase from the home_widget iOS Runner.

packages/home_widget/example/ios/Runner.xcodeproj/project.pbxproj still contains the legacy CocoaPods embed-frameworks phase (DA06ECC516BB8D6C47C7C8FB) even though the project is already wired to FlutterGeneratedPluginSwiftPackage, so it should be removed to avoid redundant embed/codesign behavior.

🛠️ Proposed cleanup
 		97C146ED1CF9000F007C117D /* Runner */ = {
 			packageProductDependencies = (
 				78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
 			);
 			isa = PBXNativeTarget;
@@
 			buildPhases = (
 				D05EB4AE28294B897266E68B /* [CP] Check Pods Manifest.lock */,
 				9740EEB61CF901F6004384FC /* Run Script */,
 				97C146EA1CF9000F007C117D /* Sources */,
 				97C146EB1CF9000F007C117D /* Frameworks */,
 				97C146EC1CF9000F007C117D /* Resources */,
 				9705A1C41CF9048500538489 /* Embed Frameworks */,
 				3AAC6A4E2B1CD43900ED5F59 /* Embed Foundation Extensions */,
-				DA06ECC516BB8D6C47C7C8FB /* [CP] Embed Pods Frameworks */,
 				3B06AD1E1E4923F5004D2608 /* Thin Binary */,
 			);
@@
-		DA06ECC516BB8D6C47C7C8FB /* [CP] Embed Pods Frameworks */ = {
-			isa = PBXShellScriptBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			inputFileListPaths = (
-				"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
-			);
-			name = "[CP] Embed Pods Frameworks";
-			outputFileListPaths = (
-				"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-			shellPath = /bin/sh;
-			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
-			showEnvVarsInLog = 0;
-		};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/home_widget/example/ios/Runner.xcodeproj/project.pbxproj` around
lines 297 - 307, Remove the legacy CocoaPods embed-frameworks build phase entry
(identifier DA06ECC516BB8D6C47C7C8FB, name "[CP] Embed Pods Frameworks") from
the Runner target's buildPhases array and delete the corresponding
PBXBuildPhase/PBXCopyFilesBuildPhase object and any references to
DA06ECC516BB8D6C47C7C8FB elsewhere in the project.pbxproj so the project no
longer contains the redundant embed/codesign phase now handled by
FlutterGeneratedPluginSwiftPackage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/home_widget/lib/src/home_widget_info.dart`:
- Around line 42-45: The parsing of configuration mutates the caller-owned data
map by using cascade with removeWhere on (data['configuration']), so change the
code in the fromMap parsing for configuration to operate on a shallow copy
instead of mutating data: when reading data['configuration'] create a new Map
copy (e.g., Map.from or Map<String,dynamic>.from) and then call removeWhere/cast
on that copy before assigning to the configuration field; reference the
configuration parsing expression that currently uses ((data['configuration'] as
Map<dynamic, dynamic>?) ?..removeWhere(...))?.cast<String, dynamic>() and ensure
the original data variable is not modified.

In `@pubspec.yaml`:
- Line 5: Update the pubspec and PR text to make the minimum SDK rationale
accurate: if UIScene support is the justification, state that UIScene is
supported starting Flutter 3.41 and not 3.38.1, and either lower or correct the
Flutter minimum accordingly; if you intend to require Dart SDK ^3.10.0 and
Flutter 3.38.1 as a general breaking minimum (unrelated to UIScene), explicitly
state that in the PR/changelog and mark it as a breaking change. Ensure the
pubspec.yaml sdk: ^3.10.0 declaration is consistent with the documented Flutter
minimum and that the changelog/PR description documents the breaking-minimum
requirement and rationale for UIScene vs general SDK bump.

---

Outside diff comments:
In `@packages/home_widget/example/ios/Runner.xcodeproj/project.pbxproj`:
- Around line 297-307: Remove the legacy CocoaPods embed-frameworks build phase
entry (identifier DA06ECC516BB8D6C47C7C8FB, name "[CP] Embed Pods Frameworks")
from the Runner target's buildPhases array and delete the corresponding
PBXBuildPhase/PBXCopyFilesBuildPhase object and any references to
DA06ECC516BB8D6C47C7C8FB elsewhere in the project.pbxproj so the project no
longer contains the redundant embed/codesign phase now handled by
FlutterGeneratedPluginSwiftPackage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 87b25b1e-b95e-4a49-9d37-1ffea9b91704

📥 Commits

Reviewing files that changed from the base of the PR and between 7fe0741 and 0cf05a7.

📒 Files selected for processing (32)
  • examples/configurable_widget/ios/Flutter/AppFrameworkInfo.plist
  • examples/configurable_widget/ios/Runner.xcodeproj/project.pbxproj
  • examples/configurable_widget/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  • examples/configurable_widget/lib/android_configuration_page.dart
  • examples/configurable_widget/lib/main.dart
  • examples/configurable_widget/pubspec.yaml
  • examples/file_and_images/ios/Flutter/AppFrameworkInfo.plist
  • examples/file_and_images/ios/Runner.xcodeproj/project.pbxproj
  • examples/file_and_images/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  • examples/file_and_images/ios/Runner/AppDelegate.swift
  • examples/file_and_images/ios/Runner/Info.plist
  • examples/lockscreen_widgets/ios/Flutter/AppFrameworkInfo.plist
  • examples/lockscreen_widgets/ios/Runner.xcodeproj/project.pbxproj
  • examples/lockscreen_widgets/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  • examples/lockscreen_widgets/ios/Runner/AppDelegate.swift
  • examples/lockscreen_widgets/ios/Runner/Info.plist
  • examples/lockscreen_widgets/pubspec.yaml
  • packages/home_widget/example/integration_test/android_test.dart
  • packages/home_widget/example/integration_test/ios_test.dart
  • packages/home_widget/example/ios/Flutter/AppFrameworkInfo.plist
  • packages/home_widget/example/ios/Runner.xcodeproj/project.pbxproj
  • packages/home_widget/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  • packages/home_widget/example/lib/main.dart
  • packages/home_widget/example/pubspec.yaml
  • packages/home_widget/ios/home_widget/Sources/home_widget/HomeWidgetPlugin.swift
  • packages/home_widget/lib/src/home_widget.dart
  • packages/home_widget/lib/src/home_widget_callback_dispatcher.dart
  • packages/home_widget/lib/src/home_widget_info.dart
  • packages/home_widget/pubspec.yaml
  • packages/home_widget/test/background_test.dart
  • packages/home_widget/test/home_widget_test.dart
  • pubspec.yaml
💤 Files with no reviewable changes (4)
  • packages/home_widget/example/ios/Flutter/AppFrameworkInfo.plist
  • examples/configurable_widget/ios/Flutter/AppFrameworkInfo.plist
  • examples/file_and_images/ios/Flutter/AppFrameworkInfo.plist
  • examples/lockscreen_widgets/ios/Flutter/AppFrameworkInfo.plist

Comment on lines +42 to +45
configuration:
((data['configuration'] as Map<dynamic, dynamic>?)
?..removeWhere((key, _) => key is! String))
?.cast<String, dynamic>(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Avoid mutating the input data map while parsing configuration.

Line 43-45 removes keys in-place via cascade, which mutates caller-owned input. Clone before filtering to keep fromMap side-effect free.

Proposed fix
-      configuration:
-          ((data['configuration'] as Map<dynamic, dynamic>?)
-                ?..removeWhere((key, _) => key is! String))
-              ?.cast<String, dynamic>(),
+      configuration:
+          (data['configuration'] as Map<dynamic, dynamic>?)
+              ?.map((key, value) => MapEntry(key, value))
+              ..removeWhere((key, _) => key is! String)
+              ?.cast<String, dynamic>(),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/home_widget/lib/src/home_widget_info.dart` around lines 42 - 45, The
parsing of configuration mutates the caller-owned data map by using cascade with
removeWhere on (data['configuration']), so change the code in the fromMap
parsing for configuration to operate on a shallow copy instead of mutating data:
when reading data['configuration'] create a new Map copy (e.g., Map.from or
Map<String,dynamic>.from) and then call removeWhere/cast on that copy before
assigning to the configuration field; reference the configuration parsing
expression that currently uses ((data['configuration'] as Map<dynamic,
dynamic>?) ?..removeWhere(...))?.cast<String, dynamic>() and ensure the original
data variable is not modified.

Comment thread pubspec.yaml

environment:
sdk: ^3.9.0
sdk: ^3.10.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

What is the latest stable version of Dart SDK as of May 2026?

💡 Result:

As of 2026-05-25, the latest stable Dart SDK version is 3.11.6.[1][2] This comes from the Dart SDK stable changelog showing 3.11.6 released on 2026-05-05.[1] The Dart source tag list also has a 3.11.6 tag.[2]

Citations:


🌐 Web query:

What is the latest stable version of Flutter SDK as of May 2026?

💡 Result:

The latest stable Flutter SDK version as of May 25, 2026 is Flutter 3.44.0.[1][2] Evidence: The Flutter SDK archive documentation states that “Unless stated otherwise, the documentation on this site reflects Flutter 3.44.0” and lists Flutter 3.44 as the May 2026 stable release, with the page last updated on 2026-05-20.[1] The Flutter release notes page also lists “3.44.0” under stable releases and indicates the page reflects Flutter 3.44.0 (last updated 2026-05-15).[2]

Citations:


🌐 Web query:

What Flutter version introduced UIScene lifecycle support for iOS?

💡 Result:

Flutter version 3.41 introduced (and supports by default) UIScene lifecycle support for iOS apps. [1] Flutter’s UIScene migration documentation states: “As of Flutter 3.41, UIScene is supported by default.” [1]

Citations:


Fix the minimum SDK rationale (UIScene) and document breaking min-requirements.

  • Flutter UIScene is supported by default starting with Flutter 3.41, so requiring Flutter 3.38.1 for UIScene support isn’t consistent with the documented timeline.
  • Raising minimum SDK requirements (e.g., sdk: ^3.10.0 and the corresponding Flutter minimum) is effectively a breaking change for users pinned to older SDKs—update the PR/changelog accordingly.
  • If Dart 3.10.0 / Flutter 3.38.1 are intended minimums, ensure the PR text clearly states that intent and the rationale (separate from UIScene).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pubspec.yaml` at line 5, Update the pubspec and PR text to make the minimum
SDK rationale accurate: if UIScene support is the justification, state that
UIScene is supported starting Flutter 3.41 and not 3.38.1, and either lower or
correct the Flutter minimum accordingly; if you intend to require Dart SDK
^3.10.0 and Flutter 3.38.1 as a general breaking minimum (unrelated to UIScene),
explicitly state that in the PR/changelog and mark it as a breaking change.
Ensure the pubspec.yaml sdk: ^3.10.0 declaration is consistent with the
documented Flutter minimum and that the changelog/PR description documents the
breaking-minimum requirement and rationale for UIScene vs general SDK bump.

@nafiskabbo
Copy link
Copy Markdown

When will it get merged? and published as new version?

@ABausG ABausG linked an issue May 25, 2026 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add UIScene life cycle support

2 participants