requestPermission method

Future<bool> requestPermission(
  1. String type
)

Requests the specified permission type from the user.

The type parameter should be the name of the permission to request (e.g., "Camera", "Location"). Returns true if the permission is granted after the request, otherwise false. After requesting, it also checks and updates the permission status. If an error occurs during the request, it logs the error and returns false.

Implementation

Future<bool> requestPermission(String type) async {
  try {
    final result = await BasecraftPlatform.instance.requestPermission("request$type");
    await _checkAndSetPermission(type);
    return result;
  } catch (e) {
    debugPrint("🛑 Error requesting permission for $type: $e");
    return false;
  }
}