Skip to content

refactor: remove the get dependency#46

Open
ferrarafer wants to merge 4 commits into
mainfrom
refactor/remove-get-dependency
Open

refactor: remove the get dependency#46
ferrarafer wants to merge 4 commits into
mainfrom
refactor/remove-get-dependency

Conversation

@ferrarafer

Copy link
Copy Markdown
Contributor

Summary

Removes the get dependency from stacked_services, reimplementing every service on native Flutter APIs. The public API of the services is preserved.

The migration was done in phases, each verified green against a behavioural test suite added up front as a safety net:

  • NavigationNavigationService now uses the native Navigator through an owned GlobalKey<NavigatorState>. New StackedRouting model + StackedNavigationConfig replace Get.routing / Get.config. Transitions are built with PageRouteBuilder (buildTransitionRoute). StackObserver feeds StackedRouting using native route types only.
  • DialogGet.dialog/Get.generalDialogshowGeneralDialog; GetPlatform.isAndroiddefaultTargetPlatform.
  • Bottom sheetGet.bottomSheetshowModalBottomSheet.
  • SnackbarGetSnackBar widget + controller vendored into lib/src/snackbar/vendored/ (MIT, attributed), hosted on the navigator overlay. SnackbarConfig is unchanged.
  • pubspecget removed.

Why

Drops a heavy, monolithic dependency in favour of native Flutter, improving WASM compatibility and aligning with Stacked's existing auto_route-based direction. No third-party replacement is introduced.

Tests

New behavioural suite (43 tests, all green): navigation, dialog, bottom sheet, snackbar, route observer, transitions, and StackedService. The tests reference only the public surface, so they passed against the get implementation and continue to pass after removal.

flutter analyze is clean except 2 pre-existing @required infos.

⚠️ Breaking changes

  • StackedService.navigatorKey is now an owned GlobalKey<NavigatorState> instead of Get.key.
  • NavigationService.config's enableLog and defaultGlobalState are now no-ops.
  • popGesture and the bottom sheet enterBottomSheetDuration / exitBottomSheetDuration are kept for compatibility but are currently no-ops.

Suggest releasing as a major version.

🤖 Generated with Claude Code

Reimplements all services on native Flutter APIs and drops `get`:

- NavigationService now uses the native Navigator through an owned
  GlobalKey<NavigatorState>, with a StackedRouting model and a
  StackedNavigationConfig (replacing Get.routing / Get.config).
- Transitions are built with PageRouteBuilder (buildTransitionRoute).
- StackObserver feeds StackedRouting using native route types only.
- DialogService uses showGeneralDialog; BottomSheetService uses
  showModalBottomSheet; GetPlatform.isAndroid -> defaultTargetPlatform.
- SnackbarService uses a vendored GetSnackBar widget + controller
  (MIT, attributed) hosted on the navigator overlay; SnackbarConfig
  is preserved so the public API is unchanged.
- get removed from pubspec.yaml.

Adds a behavioural test suite (navigation, dialog, bottom sheet,
snackbar, observer, transitions) as a safety net for the migration.

BREAKING: StackedService.navigatorKey is now an owned key (was Get.key).
config(enableLog/defaultGlobalState), popGesture and the bottom sheet
enter/exit durations are kept for compatibility but are now no-ops.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqYch1wfAZ5J9fGBh38AKU
@ferrarafer ferrarafer requested a review from FilledStacks June 19, 2026 15:24

@FilledStacks FilledStacks 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.

Awesome @ferrarafer thanks for this addition.

Could you please update the example apps to use this, run the integration tests and see if it all passes please.

That should show us if the basics are still working.

ferrarafer and others added 2 commits June 22, 2026 10:11
Adds an integration_test suite that drives the example app end-to-end to
verify the get-removal refactor's behaviour through the public API:

- DialogService      -> showGeneralDialog
- SnackbarService    -> vendored GetSnackBar on the navigator overlay
- BottomSheetService -> showModalBottomSheet
- NavigationService  -> native Navigator + PageRouteBuilder transitions

Each test dismisses its transient UI and settles before ending so the
shared StackedService overlay/navigator tickers are disposed cleanly.

Also adds the integration_test dev dependency + web driver entrypoint,
and replaces deprecated MaterialStateProperty with WidgetStateProperty
in setup_bottom_sheet_ui.dart so the example analyzes clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QX2hw8ST4QPV8DpockczFm
The example's Android scaffolding (Gradle 5.6.2, AGP 7, jcenter, legacy
plugin loader) couldn't build under JDK 21, and iOS lacked the RunnerTests
XCTest target that on-device integration tests require. Regenerated both
platforms via `flutter create` and finished the migration by hand:

Android:
- Kotlin-DSL build files (settings/app/root build.gradle.kts), AGP 9.0.1,
  Gradle wrapper 9.1.0, mavenCentral.
- Removed stale Groovy build files and the old com.example.example
  MainActivity package.
- gradle.properties aligned to the current template (dropped obsolete
  enableR8/enableJetifier).
- Manifests: dropped the AGP-incompatible package= attribute and added
  android:exported on the launcher activity.

iOS:
- Regenerated the Runner project with the RunnerTests target wired into
  project.pbxproj (flutter create won't inject it into an existing
  project), plus the modern UIScene embedding (SceneDelegate) and Podfile.

App/bundle id is now com.example.stacked_services_example.

Verified: migration_smoke_test passes on the Android emulator and the iOS
simulator (DialogService, SnackbarService, BottomSheetService,
NavigationService), and `flutter analyze` is clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QX2hw8ST4QPV8DpockczFm
@ferrarafer

Copy link
Copy Markdown
Contributor Author

Validated against the example apps in Stacked-Org/stacked#1191. Both navigator_example and router_example were updated to consume this branch's get-free stacked_services (and had their leftover get direct dependency removed); their integration test suites pass green on Android — covering navigation/back, stream sources, the form (date picker, dropdown, validation), and nested bottom-nav.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSHtjk6H5yhz977P7YXgPM
@ferrarafer ferrarafer requested a review from FilledStacks June 22, 2026 16:23
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