Skip to content

[Compile]: dart analyze output override warning on sensors_plus #3844

Description

@mahendrimd

Operating System

Windows 11

Plugin

sensors_plus

Version

latest

Flutter SDK

3.44.0

Compilation command

this issue is observed after I make pull-request #3843
The pull request does not make change to the code. so I assume this issue happened before too.

Package validation found the following potential issue:
* `dart analyze` found the following issue(s):
  Analyzing lib, pubspec.yaml...

  warning - lib\sensors_plus.dart:70:2 - The annotation 'override' can only be used on fields, getters, methods, or setters. - invalid_annotation_target
  warning - lib\src\sensors_plus_web.dart:37:2 - The annotation 'override' can only be used on fields, getters, methods, or setters. - invalid_annotation_target
  warning - lib\src\sensors_plus_web.dart:46:2 - The annotation 'override' can only be used on fields, getters, methods, or setters. - invalid_annotation_targ[...] The annotation 'override' can only be used on fields, getters, methods, or setters. - invalid_annotation_target
     info - lib\src\web_sensors.dart:25:10 - 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. - invalid_runtime_check_with_js_interop_types

  7 issues found.

Dart Dependencies

Native dependencies


Compilation Error

Package validation found the following potential issue:
* `dart analyze` found the following issue(s):
  Analyzing lib, pubspec.yaml...

  warning - lib\sensors_plus.dart:70:2 - The annotation 'override' can only be used on fields, getters, methods, or setters. - invalid_annotation_target
  warning - lib\src\sensors_plus_web.dart:37:2 - The annotation 'override' can only be used on fields, getters, methods, or setters. - invalid_annotation_target
  warning - lib\src\sensors_plus_web.dart:46:2 - The annotation 'override' can only be used on fields, getters, methods, or setters. - invalid_annotation_targ[...] The annotation 'override' can only be used on fields, getters, methods, or setters. - invalid_annotation_target
     info - lib\src\web_sensors.dart:25:10 - 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. - invalid_runtime_check_with_js_interop_types

  7 issues found.

Flutter Doctor

[√] Flutter (Channel stable, 3.44.0, on Microsoft Windows [Version 10.0.26200.8246], locale en-ID) [200ms]
    • Flutter version 3.44.0 on channel stable at C:\Users\user\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 559ffa3f75 (12 days ago), 2026-05-15 14:13:13 -0700
    • Engine revision 4c525dac5e
    • Dart version 3.12.0
    • DevTools version 2.57.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android,
      enable-ios, cli-animations, enable-native-assets, enable-swift-package-manager, omit-legacy-version-file,
      enable-lldb-debugging, enable-uiscene-migration

[√] Windows Version (Windows 11 or higher, 25H2, 2009) [832ms]

[√] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [4.9s]
    • Android SDK at C:\Users\user\AppData\Local\Android\sdk
    • Emulator version 36.5.11.0 (build_id 15261927) (CL:N/A)
    • Platform android-36.1, build-tools 36.1.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.10+-14961533-b1163.108)
    • All Android licenses accepted.

[√] Chrome - develop for the web [11ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps [10ms]
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Connected device (3 available) [256ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26200.8246]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 148.0.7778.181
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 147.0.3912.98

[√] Network resources [1,308ms]
    • All expected network resources are available.

! Doctor found issues in 1 category.

Checklist before submitting a bug

  • I searched issues in this repository and couldn't find such bug/problem
  • I Google'd a solution and I couldn't find it
  • I searched on StackOverflow for a solution and I couldn't find it
  • I read the README.md file of the plugin
  • I'm using the latest version of the plugin
  • All dependencies are up to date with flutter pub upgrade
  • I did a flutter clean
  • I tried running the example project

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions