Skip to content

Commit

Permalink
examples/{advanced_books}: [fix] title query edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
slovnicki committed Jan 26, 2022
1 parent 4120f3e commit 1045ab3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/advanced_books/lib/location_builders.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ final simpleLocationBuilder = RoutesLocationBuilder(
child: HomeScreen(),
),
'/books': (context, state, data) {
final titleQuery =
state.queryParameters['title'] ?? (data as Map)['title'] ?? '';
final titleQuery = state.queryParameters['title'] ??
(data is Map ? (data['title'] ?? '') : '');
final genreQuery = state.queryParameters['genre'] ?? '';
final pageTitle = titleQuery != ''
? "Books with name '$titleQuery'"
Expand Down Expand Up @@ -117,8 +117,8 @@ class BooksLocation extends BeamLocation<BeamState> {
final beamPages = [...HomeLocation().buildPages(context, state)];

if (state.pathPatternSegments.contains('books')) {
final titleQuery =
state.queryParameters['title'] ?? (data as Map)['title'] ?? '';
final titleQuery = state.queryParameters['title'] ??
(data is Map ? ((data as Map)['title'] ?? '') : '');
final genreQuery = state.queryParameters['genre'] ?? '';
final pageTitle = titleQuery != ''
? "Books with name '$titleQuery'"
Expand Down

0 comments on commit 1045ab3

Please sign in to comment.