Skip to content

Commit

Permalink
fix: Route params type cast error
Browse files Browse the repository at this point in the history
  • Loading branch information
0niel committed Jan 3, 2024
1 parent d8420b0 commit 9fc2539
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/presentation/core/routes/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,16 @@ GoRouter createRouter() => GoRouter(
GoRoute(
path: 'details',
builder: (context, state) {
return ScheduleDetailsPage(
lesson: state.extra as LessonSchedulePart,
);
try {
final json = state.extra as Map<String, dynamic>;
return ScheduleDetailsPage(
lesson: LessonSchedulePart.fromJson(json),
);
} catch (e) {
return ScheduleDetailsPage(
lesson: state.extra as LessonSchedulePart,
);
}
},
),
],
Expand Down

0 comments on commit 9fc2539

Please sign in to comment.