Hey folks,

You have to install the following plugin inorder to ease the dev time. I normally never recommend developers to install such plugin, but in this case, the following plugins are well maintained and less error.

permission_handler: ^9.2.0
app_settings: ^4.1.8

To check whether the device location is enabled,

if (await Permission.location.serviceStatus.isDisabled) {
    //Location is not enabled...
    AppSettings.openLocationSettings();
}

To check whether permission is granted,

bool isPermnlyDenied = await Permission.location.isPermanentlyDenied;
bool isGranted = await Permission.location.isGranted;
bool isDenied = await Permission.location.isDenied;

To request permission,

if (isGranted == false || isDenied) {
await Permission.location.request();
}

If the location permission is permanantly disabled, You need to inform user to enalbe it via app settings,

AppSettings.openAppSettings();

Let me know if you have any issues here.