tlserver / flutter_map_location_marker

A flutter map plugin for displaying device current location.
https://pub.dev/packages/flutter_map_location_marker
BSD 3-Clause "New" or "Revised" License
102 stars 93 forks source link

LateInitializationError: Field '_headingStreamSubscription' has not been initialized. #92

Closed Nico04 closed 10 months ago

Nico04 commented 11 months ago

Describe the bug An error is thrown when opening page of "Default Stream Example" from fresh git clone. Remark : it throws also on anothers exemple, like "Minimum Example" And it throws each time you open the page, not only the first time.

To Reproduce Steps to reproduce the behavior:

  1. Clone repo
  2. Launch example project in debug mode on a Android 13 emulator.
  3. Open "Default Stream Example" page
  4. An error is thrown
E/flutter ( 4716): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: LateInitializationError: Field '_headingStreamSubscription@315137202' has not been initialized.
E/flutter ( 4716): #0      _CurrentLocationLayerState._headingStreamSubscription (package:flutter_map_location_marker/src/current_location_layer.dart)
E/flutter ( 4716): #1      _CurrentLocationLayerState._subscriptPositionStream.<anonymous closure> (package:flutter_map_location_marker/src/current_location_layer.dart:349:9)
...

Desktop (please complete the following information): Flluter v3.13.9 flutter_map: 6.0.1 flutter_map_location_marker: 8.0.1

Smartphone (please complete the following information): Android 13 emulator

tlserver commented 10 months ago

Ok, one more condition: the permission need not be granted. I can reproduce now.

Nico04 commented 10 months ago

Well maybe you need to refuse permission once. Because error happen after even if permission is granted (at least after one permission refusal) Thanks

Nico04 commented 10 months ago

After some basic test, I can confirm it doesn't throw anymore, thanks