get method

  1. @override
Future<LocationResult> get({
  1. LocationProfile? profile,
  2. bool withAddress = false,
  3. bool handlePermission = true,
  4. bool handleServices = true,
  5. LocationAccuracy? accuracy,
  6. Duration? maxAge,
  7. Duration? timeout,
  8. Locale? locale,
  9. BuildContext? context,
})
override

One location, with everything around it handled:

  1. Permission — runs the baaba_permission_handler flow (rationale, prompt, Settings with steps) unless handlePermission is false.
  2. Services — if location is off, shows Android's in-app "turn on location" dialog (or a dialog that opens location settings) and waits, unless handleServices is false.
  3. Precision — if the profile needs precise location and only approximate is allowed, asks once; otherwise carries on with isApproximate: true.
  4. Fix — reuses a fix younger than maxAge, otherwise requests one.
  5. Fallback — if none arrives in time, returns the last known location up to LocationConfig.maxFallbackAge old, as a success.
  6. Address — with withAddress; a geocoding failure only sets addressFailure.

accuracy, maxAge and timeout override the profile's. Concurrent calls share one flow and one set of dialogs.

Implementation

@override
Future<LocationResult> get({
  LocationProfile? profile,
  bool withAddress = false,
  bool handlePermission = true,
  bool handleServices = true,
  LocationAccuracy? accuracy,
  Duration? maxAge,
  Duration? timeout,
  Locale? locale,
  BuildContext? context,
}) => _record(
  'get',
  {
    'profile': profile,
    'withAddress': withAddress,
    'handlePermission': handlePermission,
    'handleServices': handleServices,
    'accuracy': accuracy,
    'maxAge': maxAge,
    'timeout': timeout,
    'locale': locale,
  },
  () => _impl.get(
    profile: profile,
    withAddress: withAddress,
    handlePermission: handlePermission,
    handleServices: handleServices,
    accuracy: accuracy,
    maxAge: maxAge,
    timeout: timeout,
    locale: locale,
    context: context,
  ),
);