wongpiwat / trust-location

A Flutter plugin for detecting mock location on Android device. (Supports only high accuracy location mode)
https://pub.dev/packages/trust_location
BSD 3-Clause "New" or "Revised" License
15 stars 8 forks source link

Different result every time app re-load #5

Closed yusrenaltair closed 4 years ago

yusrenaltair commented 4 years ago

I tried your package and I haven't found a solution to deal with different results each time my application reloads with one call

await TrustLocation.isMockLocation

Trusted results can only be obtained by repeating as you write in the example folder. Are there other solutions to guarantee the results are correct without repeating by timer?

wongpiwat commented 4 years ago

@young-altair I have added stream getter where you can use this without coding a timer in your source code. Code example here. trust_location

yusrenaltair commented 4 years ago

Thanks a lot !

yusrenaltair commented 4 years ago

I am facing a new problem with the latest version. I want to use a stream in another class but the following error appears

[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: Stream has already been listened to.

I changed the code as below File : trust_location.dart from

static var changeController = new StreamController<LatLongPosition>();

to

static var changeController = new StreamController<LatLongPosition>.broadcast();

Is this correct?

wongpiwat commented 4 years ago

@young-altair Correct. Thank you for suggestion. I will update it with next release.