riverpod_navigator 0.3.0 copy "riverpod_navigator: ^0.3.0" to clipboard
riverpod_navigator: ^0.3.0 copied to clipboard

outdated

Simple but powerfull Flutter navigation with riverpod, freezed and Navigator 2.0.

Navigator for Riverpod #

Simple but powerfull navigation library (based on Flutter Navigator 2.0, Riverpod, and Freezed) that solves the following problems: #

  • Strictly typed navigation:
    You can use navigate([Home(), Books(), Book(id: bookId)]); instead of navigate('home/books/$bookId'); in your code.
  • Easier coding:
    The problem of navigation is reduced to manipulation an immutable collection.
  • Better separation of concerns: UI x Model (thanks to riverpod 👍):
    Navigation logic can be developed and tested without typing a single flutter widget.
  • Asynchronous navigation:
    Prepare all necessary asynchronous operations before the navigation starts, e.g.
    • save data from the previous screen
    • loading data for new screen
  • Dependence on external providers:
    The navigation state may also depend on external providers, e.g. user login status
  • Possibility to configure many navigation parameters, e.g. Page builder, Navigator builder, Splash screen

The mission #

Let's look at the following concepts:

  • [string path], e.g stringPath = 'home/books/book;id=2';
  • string segment (the string path consists of three string segments), e.g. 'home', 'books', 'book;id=2'
  • [typed path], e.g. typedPath = <TypedSegment>[HomeSegment(), BooksSegment(), BookSegment(id:2)];
  • typed segment, e.g. HomeSegment(), BooksSegment(), BookSegment()
  • [navigation stack] of Flutter Navigator 2.0. e.g. HomeScreen(HomeSegment())) => BooksScreen(BooksSegment()) => BookScreen(BookSegment(id:3))

The mission of navigation is to keep

[string path] <=> [typed path] <=> [navigation stack]

always in a synchronous state.

Simple example #

25
likes
0
pub points
57%
popularity

Publisher

unverified uploader

Simple but powerfull Flutter navigation with riverpod, freezed and Navigator 2.0.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, freezed_annotation, hooks_riverpod, json_annotation, meta, riverpod, tuple

More

Packages that depend on riverpod_navigator