Sammanfattning

Flutter, a popular cross-platform framework, offers two navigation application programming interfaces (APIs): the imperative Navigator 1.0, which is convenient but limited, and the declarative Navigator 2.0, which is powerful but too complex for direct use in most applications. Existing routing packages built on Navigator 2.0 focus primarily on uniform resource locator (URL)- based navigation, which often leads to compromises in architecture and state management for mobile-first applications. This thesis proposes a new navigation library for Flutter, built upon the Flow Controller (Coordinator) pattern and Navigator 2.0, aiming to provide a scalable and intuitive solution for managing complex, stateful navigation flows. The resulting package, flow_coordinator, decouples screens from navigation logic using abstract “exit points” and centralizes flowcontrol within stateful widgets called Flow Coordinators, each managing its own navigation stack. The design supports nested navigators, deep link propagation, hierarchical back button handling, and browser URL synchronization. The library capably handles complex scenarios identified by the Flutter team, including deep linking, sign-in routing, nested routing, and “stack skipping”. A quantitative code complexity comparison against GoRouter, the officially recommended Flutter routing package, was conducted using three metrics: Navigation Lines of Code, Coupling Between Objects, and Change Impact. The evaluation shows that GoRouter is more concise for simple, standalone scenarios, but the Flow Coordinator approach provides measurable advantages in change isolation: screen source files are never modified when adding routes or reusing screens across flows, and routing concerns are expressed through typed interfaces rather than hardcoded path strings. These properties become increasingly valuable as an application’s navigation graph grows in complexity, making the library a strong, modular alternative to traditional URL-centric routing.

Utforska vidare

Liknande uppsatser

Uppsatser med liknande ämnen och nyckelord.