Skip to content

Commit 817ae00

Browse files
authored
fix compile error with web 1.0 (#1364)
#1363
1 parent ddc2203 commit 817ae00

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

permission_handler_html/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.3+2
2+
3+
- `web: 1.0.0` compatibility: `PermissionDescriptor` was removed in web package.
4+
15
## 0.1.3+1
26

37
- Fixes the PermissionDescriptor Error when getting the permission status.

permission_handler_html/lib/web_delegate.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class WebDelegate {
6363
Future<PermissionStatus> _permissionStatusState(
6464
String webPermissionName, web.Permissions? permissions) async {
6565
final webPermissionStatus = await permissions
66-
?.query(web.PermissionDescriptor(name: webPermissionName))
66+
?.query(_PermissionDescriptor(name: webPermissionName))
6767
.toDart;
6868
return _toPermissionStatus(webPermissionStatus?.state);
6969
}
@@ -228,3 +228,11 @@ class WebDelegate {
228228
}
229229
}
230230
}
231+
232+
// copied from https://github.com/dart-lang/web/commit/7604578eb538c471d438608673c037121d95dba5#diff-6f4c7956b6e25b547b16fc561e54d5e7d520d2c79a59ace4438c60913cc2b1a2L35-L40
233+
extension type _PermissionDescriptor._(JSObject _) implements JSObject {
234+
external factory _PermissionDescriptor({required String name});
235+
236+
external set name(String value);
237+
external String get name;
238+
}

permission_handler_html/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: permission_handler_html
22
description: Permission plugin for Flutter. This plugin provides the web API to request and check permissions.
3-
version: 0.1.3+1
3+
version: 0.1.3+2
44

55
homepage: https://github.com/baseflow/flutter-permission-handler
66

77
environment:
8-
sdk: ">=3.0.5 <4.0.0"
8+
sdk: ">=3.3.0 <4.0.0"
99
flutter: ">=3.16.0"
1010

1111
dependencies:

0 commit comments

Comments
 (0)