import 'package:permission_handler/permission_handler.dart';

extension PermissionConverter on Permission {
  static Permission fromString(String permissionName) {
    final matchedPermissions =
        Permission.values.where((e) => e.toString() == "Permission.$permissionName");
    if (matchedPermissions.isNotEmpty) return matchedPermissions.first;
    return Permission.unknown;
  }
}