checkLocationServiceEnabled method

  1. @override
Future<bool> checkLocationServiceEnabled()
override

Returns true if the device's location services are currently enabled.

This is independent of app-level permission — the user may have location permission granted but still have location services turned off globally.

Implementation

@override
Future<bool> checkLocationServiceEnabled() async {
  try {
    final enabled = await methodChannel.invokeMethod<bool>(
      'checkLocationServiceEnabled',
    );
    return enabled ?? false;
  } on PlatformException catch (e) {
    throw LocationPlatformException(
      message: e.message ?? 'Failed to check location service',
      code: e.code,
    );
  }
}