Skip to content

Commit

Permalink
Fix type 'Null' is not a subtype of type 'Course' in type cast when…
Browse files Browse the repository at this point in the history
… popping the course create page (#1018)

Fixes #1017
  • Loading branch information
nilsreichardt authored Sep 19, 2023
1 parent e19da1d commit 200a966
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Future<Course?> openCourseCreatePage(
Course? course,
String? schoolClassId,
}) async {
// We use `dynamic` as type because we return either a `Course?` or `bool`.
final createdCourse = await Navigator.push<dynamic>(
context,
IgnoreWillPopScopeWhenIosSwipeBackRoute(
Expand All @@ -38,7 +39,7 @@ Future<Course?> openCourseCreatePage(
seconds: 2,
);
}
return createdCourse as Course;
return createdCourse is Course ? createdCourse : null;
}

Future<void> submit(BuildContext context) async {
Expand Down

0 comments on commit 200a966

Please sign in to comment.