grant method

  1. @override
Future<void> grant()

Grant permission for the requested resource(s).

Implementation

@override
Future<void> grant() {
  return _request
      .grant(types.map<String>((WebViewPermissionResourceType type) {
    switch (type) {
      case WebViewPermissionResourceType.camera:
        return android_webview.PermissionRequest.videoCapture;
      case WebViewPermissionResourceType.microphone:
        return android_webview.PermissionRequest.audioCapture;
      case AndroidWebViewPermissionResourceType.midiSysex:
        return android_webview.PermissionRequest.midiSysex;
      case AndroidWebViewPermissionResourceType.protectedMediaId:
        return android_webview.PermissionRequest.protectedMediaId;
    }

    throw UnsupportedError(
      'Resource of type `${type.name}` is not supported.',
    );
  }).toList());
}