Skip to content

chore(samples): migrate from flutter_app_badger to app_badge_plus - #2836

Merged
xsahil03x merged 4 commits into
masterfrom
chore/migrate-to-app-badge-plus
Jul 22, 2026
Merged

chore(samples): migrate from flutter_app_badger to app_badge_plus#2836
xsahil03x merged 4 commits into
masterfrom
chore/migrate-to-app-badge-plus

Conversation

@xsahil03x

@xsahil03x xsahil03x commented Jul 22, 2026

Copy link
Copy Markdown
Member

Fixes FLU-623

Summary

Migrates the sample app's badge handling from the unmaintained, pod-only flutter_app_badger to app_badge_plus (^1.3.2).

flutter_app_badger does not support Swift Package Manager (FLU-623). app_badge_plus is a maintained drop-in replacement that ships SPM support (Package.swift for both iOS and macOS), aligning with the ongoing SPM migration effort. After the swap, flutter pub get confirms it no longer appears in Flutter's "plugins that do not support SPM" warning list.

Changes

Dependency swap

  • melos.yaml / sample_app/pubspec.yamlflutter_app_badger: ^1.5.0app_badge_plus: ^1.3.2

API update (channel_list_page.dart)

  • FlutterAppBadger.updateBadgeCount(count) / removeBadge()AppBadgePlus.updateBadge(math.max(0, count))

Platform guard — extracted into an isAppBadgeSupported getter in platform_support.dart (renamed from firebase_support.dart, since it now holds platform-capability flags beyond Firebase). app_badge_plus only implements Android, iOS, and macOS.

Notes

  • No Android manifest changes needed. The manufacturer launcher permissions (Samsung, HTC, Sony, Apex, Solid, Huawei, Honor, Vivo) are declared in app_badge_plus's own plugin manifest and merged in automatically by the Android manifest merger — no manual declaration required. (This differs from flutter_app_badger, whose permissions came transitively from the bundled ShortcutBadger AAR.)
  • iOS UIBackgroundModes / remote-notification in Info.plist is retained — required by firebase_messaging, not the badge plugin.
  • Notification permission (which app_badge_plus needs before setting a badge) is already handled via FirebaseMessaging.instance.requestPermission(); POST_NOTIFICATIONS merges in transitively via firebase_messaging.

Testing

  • flutter pub get in sample_app resolves cleanly (flutter_app_badger dropped, app_badge_plus added).
  • iOS simulator: badge sets correctly; note that UNUserNotificationCenter.setBadgeCount persistence on the simulator is unreliable — verify numeric badges on a physical device.
  • Android numeric badges only render on manufacturer launchers (Samsung/MIUI/etc.); the stock Pixel launcher is unsupported by design and shows only notification dots.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The sample app replaces flutter_app_badger with app_badge_plus, centralizes platform support checks, and updates unread-count badge handling for supported Android, iOS, and macOS platforms.

Changes

App badge provider replacement

Layer / File(s) Summary
Centralize platform support checks
sample_app/lib/utils/platform_support.dart, sample_app/lib/main.dart, sample_app/lib/notification/notification_service.dart
Adds isAppBadgeSupported for Android, iOS, and macOS, and updates Firebase support imports to use platform_support.dart.
Replace badge dependency and update API
melos.yaml, sample_app/pubspec.yaml, sample_app/lib/pages/channel_list_page.dart
Replaces flutter_app_badger with app_badge_plus; supported platforms register unread listeners and call AppBadgePlus.updateBadge with non-negative counts.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely states the main change: migrating sample badge handling from flutter_app_badger to app_badge_plus.
✨ 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 chore/migrate-to-app-badge-plus

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.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 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 `@sample_app/pubspec.yaml`:
- Line 23: Remove the stale flutter_app_badger.framework references from the iOS
project configuration associated with the sample app, including its build-phase
and framework-link entries, after the dependency change represented by
app_badge_plus. Regenerate the native project if appropriate, then validate that
a clean iOS build succeeds without missing-framework errors.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: b92e6fcb-e48f-4fbc-a074-f08e00a0f595

📥 Commits

Reviewing files that changed from the base of the PR and between 5991082 and f164adb.

📒 Files selected for processing (3)
  • melos.yaml
  • sample_app/lib/pages/channel_list_page.dart
  • sample_app/pubspec.yaml

Comment thread sample_app/pubspec.yaml
flutter: ">=3.41.0"

dependencies:
app_badge_plus: ^1.3.2

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Remove the stale flutter_app_badger native references.

sample_app/ios/Runner.xcodeproj/project.pbxproj still links flutter_app_badger.framework at lines 292 and 339. After removing this dependency, those entries can cause iOS builds to fail with a missing framework. Remove or regenerate the native references and validate a clean iOS build.

🤖 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 `@sample_app/pubspec.yaml` at line 23, Remove the stale
flutter_app_badger.framework references from the iOS project configuration
associated with the sample app, including its build-phase and framework-link
entries, after the dependency change represented by app_badge_plus. Regenerate
the native project if appropriate, then validate that a clean iOS build succeeds
without missing-framework errors.

@xsahil03x xsahil03x changed the title chore(sample): migrate from flutter_app_badger to app_badge_plus chore(samples): migrate from flutter_app_badger to app_badge_plus Jul 22, 2026
flutter_app_badger is unmaintained and pod-only. app_badge_plus is a
maintained drop-in replacement that ships Swift Package Manager support
for iOS and macOS.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xsahil03x
xsahil03x force-pushed the chore/migrate-to-app-badge-plus branch 2 times, most recently from 5245204 to 2441fed Compare July 22, 2026 11:07
xsahil03x and others added 3 commits July 22, 2026 14:11
app_badge_plus only implements Android, iOS, and macOS, so restrict the
badge listener to those platforms instead of running on any non-web
platform (which would fail on Windows/Linux).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move the badge platform guard into an `isAppBadgeSupported` getter and
rename `firebase_support.dart` to `platform_support.dart`, since the file
now holds platform-capability flags beyond Firebase.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collapse the count>0 / else branch into a single `updateBadge` call
clamped at zero.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xsahil03x
xsahil03x force-pushed the chore/migrate-to-app-badge-plus branch from 1a8f5f8 to a788f4e Compare July 22, 2026 12:11
@xsahil03x
xsahil03x enabled auto-merge (squash) July 22, 2026 12:21
@xsahil03x
xsahil03x merged commit cefa2b4 into master Jul 22, 2026
29 of 30 checks passed
@xsahil03x
xsahil03x deleted the chore/migrate-to-app-badge-plus branch July 22, 2026 12:25
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.

2 participants