Skip to content

Commit

Permalink
fix _findDevicesTimer late init error
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmohsin7 committed Sep 8, 2024
1 parent 57101de commit 2e07c31
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/lib/providers/onboarding_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OnboardingProvider extends BaseProvider with MessageNotifierMixin {
Timer? connectionStateTimer;
List<BTDeviceStruct> deviceList = [];
late Timer _didNotMakeItTimer;
late Timer _findDevicesTimer;
Timer? _findDevicesTimer;
bool enableInstructions = false;
Map<String, BTDeviceStruct> foundDevicesMap = {};

Expand Down Expand Up @@ -101,8 +101,8 @@ class OnboardingProvider extends BaseProvider with MessageNotifierMixin {
//----------------- Onboarding Permissions -----------------

void stopFindDeviceTimer() {
if (_findDevicesTimer != null && _findDevicesTimer.isActive) {
_findDevicesTimer.cancel();
if (_findDevicesTimer != null && (_findDevicesTimer?.isActive ?? false)) {
_findDevicesTimer!.cancel();
}
if (connectionStateTimer?.isActive ?? false) {
connectionStateTimer?.cancel();
Expand Down Expand Up @@ -223,7 +223,7 @@ class OnboardingProvider extends BaseProvider with MessageNotifierMixin {
@override
void dispose() {
//TODO: This does not get called when the page is popped
_findDevicesTimer.cancel();
_findDevicesTimer?.cancel();
_didNotMakeItTimer.cancel();
connectionStateTimer?.cancel();
super.dispose();
Expand Down

0 comments on commit 2e07c31

Please sign in to comment.