requestPermission static method

Future<bool> requestPermission(
  1. List<Permission> permissions
)

Implementation

static Future<bool> requestPermission(List<Permission> permissions) async {
  final status = await permissions.request();
  Alog.e(
      tag: 'Permission',
      moduleName: 'requestPermission',
      content: 'Permission status $status');

  bool isAllGranted = true;
  bool showTip = false;
  status.forEach((key, value) {
    if (value.isDenied || value.isPermanentlyDenied) {
      isAllGranted = false;
    }
    if (value.isPermanentlyDenied) {
      showTip = true;
    }
  });
  if (showTip) {
    Fluttertoast.showToast(msg: S.current.permission_request_tip);
  }
  return isAllGranted;
}