Instalasi
Add the package, then move navigation and overlays into explicit state. Keep imperative push/pop out of the same stack.
Satu dependensi
Install with one pub command. No code generation setup is required.
API berpusat pada state
You control a List<PageEntry> and optional OverlayRequest as pure state.
Adopsi bertahap
Mulai dari satu alur fitur dan migrasikan layar demi layar.
Instalasi dan inisialisasi
Gunakan `pub add`, lalu sambungkan state root awal untuk halaman dan overlay.
Perintah
State awal aplikasi
import 'package:declarative_nav/declarative_nav.dart';
class _AppRootState extends State<AppRoot> {
OverlayRequest? _overlay;
late List<PageEntry> _pages;
@override
void initState() {
super.initState();
_pages = const [
PageEntry(key: 'home', name: '/home'),
];
}
}
Batasan
Di dalam satu stack, PageEntry.key harus tetap unik karena itu menjadi identitas halaman Navigator.
Sebelumnya
PengantarBerikutnya
Halaman sebagai Data