Baseflow / Baseflow/flutter-permission-handler
[Enhancement proposal]: `permission_handler_html` triggers new `invalid_runtime_check_with_js_interop_types` lint
- Dominant language
- Dart
- Stars
- 2.2k
- Forks
- 970
- Avg merge
- 14h 22m
- Merged PRs (30d)
- 2
Description
### Please check the following before submitting a new issue.
- [x] I have searched the [existing issues](https://github.com/baseflow/flutter-permission-handler/issues).
- [x] I have carefully [read the documentation](https://github.com/baseflow/flutter-permission-handler/blob/main/permission_handler/README.md) and verified I have added the required platform specific configuration.
### Please select affected platform(s)
- [ ] Android
- [ ] iOS
- [ ] Windows
### Proposal
Dart 3.12 added the [invalid_runtime_check_with_js_interop_types](https://dart.dev/tools/diagnostics/invalid_runtime_check_with_js_interop_types) lint.
When adding the following `analysis_options.yaml` to `permission_handler_html`:
```yaml
linter:
rules:
invalid_runtime_check_with_js_interop_types: true
```
`flutter analyze` outputs
```
> flutter analyze
Analyzing permission_handler_html...
info • Catch clause with type 'DOMException' checks whether the caught value is a JS interop type, which might not be platform-consistent. Remove the type in the catch clause and try using 'isA' from 'dart:js_interop' within the catch block to check if the value is a JS interop type •
lib/web_delegate.dart:94:10 • invalid_runtime_check_with_js_interop_types
info • Catch clause with type 'DOMException' checks whether the caught value is a JS interop type, which might not be platform-consistent. Remove the type in the catch clause and try using 'isA' from 'dart:js_interop' within the catch block to check if the value is a JS interop type •
lib/web_delegate.dart:124:10 • invalid_runtime_check_with_js_interop_types
2 issues found. (ran in 0.6s)
```
### Pitch
Fixing this will satisfy the newly added lint.
Contributor guide
Assessment
This issue has not been assessed yet.