requestPermission static method

Future<bool> requestPermission(
  1. Permission permission
)

Implementation

static Future<bool> requestPermission(Permission permission) async {
  if (await permission.isGranted) {
    return true;
  } else {
    var result = await permission.request();
    if (result == PermissionStatus.granted) {
      return true;
    }
  }
  return false;
}