Skip to content

Commit

Permalink
fix: loadingContext error
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 committed Apr 6, 2024
1 parent 48334ff commit 9ff4b2f
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
class Loading {
Loading(this.context);

late BuildContext loadingContext;
BuildContext? loadingContext;
final BuildContext context;

Future<void> start() async => showDialog<void>(
Expand All @@ -24,7 +24,12 @@ class Loading {
},
);

Future<void> stop() async => Navigator.of(loadingContext).pop();
Future<void> stop() async {
if (loadingContext != null) {
Navigator.of(loadingContext!).pop();
loadingContext = null;
}
}
}

class BarrierDialog {
Expand Down

0 comments on commit 9ff4b2f

Please sign in to comment.