Skip to content

fix: update Flutter deprecated list APIs#1174

Open
lollipopkit wants to merge 4 commits into
mainfrom
fix/flutter-344-deprecations
Open

fix: update Flutter deprecated list APIs#1174
lollipopkit wants to merge 4 commits into
mainfrom
fix/flutter-344-deprecations

Conversation

@lollipopkit
Copy link
Copy Markdown
Owner

@lollipopkit lollipopkit commented May 19, 2026

Summary

  • replace deprecated cacheExtent with scrollCacheExtent
  • migrate ReorderableListView callbacks from onReorder to onReorderItem
  • keep reorder index handling aligned with the adjusted onReorderItem semantics
  • update lockfile after local Flutter 3.44.0 dependency resolution

Verification

  • flutter analyze lib test

Notes

  • Flutter 3.44.0 reports Swift Package Manager adoption warnings for existing plugins; analyze still passes.

Summary by CodeRabbit

  • Performance

    • Improved list caching for smoother scrolling in server stats.
  • Bug Fixes

    • Fixed drag-and-drop reordering across multiple settings screens so items land consistently after moves.
  • Chores

    • Updated Flutter SDK requirement and iOS build configuration for newer toolchain and package support.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

📝 Walkthrough

Walkthrough

This PR migrates ReorderableListView across five settings/sequence pages from the deprecated onReorder callback to the newer onReorderItem, and removes index compensation logic that previously adjusted target indices for downward element moves. Additionally, connection_stats.dart replaces the legacy cacheExtent parameter with the new ScrollCacheExtent.pixels() API after importing flutter/rendering.dart. The reorder callback changes affect tab ordering in home tabs, server and server-detail ordering, virtual-key sequencing, and server function sequencing, with the function sequence page adding bounds validation to prevent reordering into disabled list regions.

Possibly related PRs

  • lollipopkit/flutter_server_box#930: Directly modifies the same server order drag-reorder handling in srv_seq.dart, switching callback types and adjusting index computation.
  • lollipopkit/flutter_server_box#1026: Refactors reorder handling in srv_detail_seq.dart, srv_func_seq.dart, and virt_key.dart, overlapping with this PR's callback and index logic changes.
  • lollipopkit/flutter_server_box#1052: Also updates the packages/fl_lib submodule pointer and touches dependency configuration, related to this PR's submodule and pubspec adjustments.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating deprecated Flutter list APIs (cacheExtent to scrollCacheExtent and onReorder to onReorderItem callbacks).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/flutter-344-deprecations

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

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 19, 2026
Copy link
Copy Markdown
Contributor

@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: 3

🤖 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 `@ios/Runner.xcodeproj/project.pbxproj`:
- Around line 1238-1241: The XCSwiftPackageProductDependency entry for
FlutterGeneratedPluginSwiftPackage is missing the required package reference;
update the XCSwiftPackageProductDependency object (the one named
FlutterGeneratedPluginSwiftPackage) to include a package = <identifier> /*
XCLocalSwiftPackageReference */; field that points to the corresponding
XCLocalSwiftPackageReference entry so the product is explicitly linked to its
package.

In `@lib/data/ssh/persistent_shell.dart`:
- Line 166: The code is using the wrong named parameter `_allowMalformed` on
Utf8Decoder which causes a compile error; update the Utf8Decoder invocations
used in the stream transforms (the .transform(const Utf8Decoder(...)) calls in
persistent_shell.dart, e.g., inside the PersistentShell read/stream handling
methods) to use the correct named parameter allowMalformed: true instead of
_allowMalformed: true, and ensure both occurrences (the one at line ~166 and the
one at line ~175) are corrected.

In `@pubspec.yaml`:
- Around line 33-36: The pubspec currently references moving branch refs for the
git dependencies re_editor and icons_plus (ref: main); update both dependency
entries in pubspec.yaml to pin them to immutable refs by replacing ref: main
with a specific tag name or commit SHA (e.g., ref: vX.Y.Z or ref: <commit-sha>)
so builds are deterministic and won’t pull unreviewed upstream changes; locate
the re_editor and icons_plus git blocks and set their ref values to the chosen
tag or commit SHA.
🪄 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: 8798657f-9a4d-4fed-a2b8-b76f4374f039

📥 Commits

Reviewing files that changed from the base of the PR and between 6e918b0 and 272c402.

⛔ Files ignored due to path filters (2)
  • ios/Podfile.lock is excluded by !**/*.lock
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • .github/workflows/build.yml
  • ios/Runner.xcodeproj/project.pbxproj
  • ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
  • ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  • ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved
  • lib/data/ssh/persistent_shell.dart
  • packages/circle_chart
  • packages/fl_lib
  • packages/plain_notification_token
  • packages/watch_connectivity
  • pubspec.yaml
✅ Files skipped from review due to trivial changes (4)
  • packages/watch_connectivity
  • .github/workflows/build.yml
  • ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
  • ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved

Comment on lines +1238 to +1241
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
isa = XCSwiftPackageProductDependency;
productName = FlutterGeneratedPluginSwiftPackage;
};
Copy link
Copy Markdown
Contributor

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

🏁 Script executed:

#!/bin/bash
# Verify whether any XCSwiftPackageProductDependency entries are missing a `package =` linkage.
# Expected: each product dependency block should include a `package =` line.

python3 - <<'PY'
import re, pathlib
p = pathlib.Path("ios/Runner.xcodeproj/project.pbxproj")
txt = p.read_text()
blocks = re.findall(r'/\* Begin XCSwiftPackageProductDependency section \*/(.*?)/\* End XCSwiftPackageProductDependency section \*/', txt, re.S)
if not blocks:
    print("No XCSwiftPackageProductDependency section found")
    raise SystemExit(0)
section = blocks[0]
entries = re.findall(r'(\w+ /\* .*? \*/ = \{\n.*?\n\t\t\};)', section, re.S)
for e in entries:
    header = e.splitlines()[0].strip()
    has_package = "package =" in e
    print(f"{header} -> package_link={'yes' if has_package else 'no'}")
PY

Repository: lollipopkit/flutter_server_box

Length of output: 163


🏁 Script executed:

#!/bin/bash
# Check if the XCLocalSwiftPackageReference with ID 781AD8BC2B33823900A9FFBB exists
rg "781AD8BC2B33823900A9FFBB" ios/Runner.xcodeproj/project.pbxproj -A 2 -B 2

Repository: lollipopkit/flutter_server_box

Length of output: 647


🏁 Script executed:

#!/bin/bash
# List all XCLocalSwiftPackageReference entries in the file
rg "XCLocalSwiftPackageReference" ios/Runner.xcodeproj/project.pbxproj -B 1 -A 5

Repository: lollipopkit/flutter_server_box

Length of output: 951


🌐 Web query:

Xcode XCSwiftPackageProductDependency package attribute required field pbxproj schema

💡 Result:

In an Xcode project.pbxproj, the object type XCSwiftPackageProductDependency represents a Swift Package Manager product dependency and includes these fields: 1) package (required) - This points to either an XCRemoteSwiftPackageReference or an XCLocalSwiftPackageReference object. It is defined as a one-to-one attribute “package” with allowed classes [1]. 2) productName (required) - This is the product’s name. It is defined as an attribute:product_name, String in xcodeproj’s model (which maps to the pbxproj field productName) [2][1]. What’s in the pbxproj “schema” for XCSwiftPackageProductDependency (example from generated pbxproj) - An XCSwiftPackageProductDependency section will look like this: isa = XCSwiftPackageProductDependency; package = /*... */; productName = ; This exact field pattern (isa/package/productName) is shown in a real pbxproj snippet produced by Xcode [3]. Notes on “required” - Based on the xcodeproj object model, both package and product_name/productName are declared as attributes for the XCSwiftPackageProductDependency object (with package defined as a required association “has_one:package...” and product_name defined as an attribute String) [2][1]. - If you omit/leave these out (or have mismatches), tooling that parses/rewrites pbxproj may fail or consider the dependency inconsistent (seen in issues around XCSwiftPackageProductDependency objects) [3][4].

Citations:


Add explicit package linkage for the Swift package product dependency.

Line 1238 defines XCSwiftPackageProductDependency without a package reference. According to Xcode's pbxproj schema, the package field is required for this object type. This omission can cause build failures or tooling inconsistencies when parsing the project file. The product dependency must be explicitly bound to the XCLocalSwiftPackageReference.

Suggested fix
 		78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
 			isa = XCSwiftPackageProductDependency;
+			package = 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */;
 			productName = FlutterGeneratedPluginSwiftPackage;
 		};
🤖 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 `@ios/Runner.xcodeproj/project.pbxproj` around lines 1238 - 1241, The
XCSwiftPackageProductDependency entry for FlutterGeneratedPluginSwiftPackage is
missing the required package reference; update the
XCSwiftPackageProductDependency object (the one named
FlutterGeneratedPluginSwiftPackage) to include a package = <identifier> /*
XCLocalSwiftPackageReference */; field that points to the corresponding
XCLocalSwiftPackageReference entry so the product is explicitly linked to its
package.

Comment thread lib/data/ssh/persistent_shell.dart Outdated
Comment thread pubspec.yaml
Comment on lines +33 to +36
re_editor:
git:
url: https://github.com/lollipopkit/re-editor
ref: main
Copy link
Copy Markdown
Contributor

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

🏁 Script executed:

#!/bin/bash
# Verify git dependency pinning and lockfile resolved refs (read-only).
set -euo pipefail

echo "== pubspec.yaml git refs =="
rg -n -A3 -B1 '^\s{2}(re_editor|icons_plus):|^\s{4}git:|^\s{6}url:|^\s{6}ref:' pubspec.yaml

LOCKFILE="$(fd -a '^pubspec\.lock$' | head -n1 || true)"
if [[ -n "${LOCKFILE}" ]]; then
  echo
  echo "== pubspec.lock resolved refs for re_editor/icons_plus =="
  rg -n -A8 -B2 're_editor:|icons_plus:|resolved-ref:|ref:' "${LOCKFILE}"
else
  echo
  echo "pubspec.lock not found; cannot verify resolved-ref pinning."
fi

Repository: lollipopkit/flutter_server_box

Length of output: 2228


Pin git dependencies to immutable commits/tags instead of main.

Using moving branch refs makes builds non-deterministic and can pull unreviewed upstream changes after merge. Both re_editor (line 36) and icons_plus (line 52) should be pinned to immutable tags or commit SHAs.

🔧 Suggested change
  re_editor:
    git:
      url: https://github.com/lollipopkit/re-editor
-     ref: main
+     ref: <tag-or-commit-sha>
@@
  icons_plus:
    git:
      url: https://github.com/lollipopkit/icons_plus
-     ref: main
+     ref: <tag-or-commit-sha>
🤖 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` around lines 33 - 36, The pubspec currently references moving
branch refs for the git dependencies re_editor and icons_plus (ref: main);
update both dependency entries in pubspec.yaml to pin them to immutable refs by
replacing ref: main with a specific tag name or commit SHA (e.g., ref: vX.Y.Z or
ref: <commit-sha>) so builds are deterministic and won’t pull unreviewed
upstream changes; locate the re_editor and icons_plus git blocks and set their
ref values to the chosen tag or commit SHA.

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.

1 participant