Skip to content

[Enhancement proposal]: permission_handler_html triggers new invalid_runtime_check_with_js_interop_types lint #1529

@TheJanzap

Description

@TheJanzap

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Windows

Proposal

Dart 3.12 added the invalid_runtime_check_with_js_interop_types lint.

When adding the following analysis_options.yaml to permission_handler_html:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions