Since upgrading to Dart SDK 1.18.1, we are seeing intermittent dartanalyzer failures when leveraging the js package for interop. I haven't been able to build a small, reproducing app and it also seems to be a lot more rare that it reproduces locally. It happens quite regularly in our build system which is running a Linux image, if that makes a difference. Here is the gist of what we are running into:
_config.dart_:
@JS()
library config;
part 'src/config/browser.dart';
_src/config/browser.dart_:
part of config;
@JS()
external String get CONFIG_SETTING;
Sometimes the analyzer is fine with this, other times it errors out on both files, line 1 of config.dart and line 3 of browser.dart. Let me know if you have any questions I could answer to help narrow it down.
To clarify, this is actually a hint not an error, but we typically use --fatal-hints.
I saw it with 1.18.0 as well as 1.18.1.
I have not been able to reproduce this behavior locally, and I could not see ay obvious problems based on the implementation.
Sometimes the analyzer is fine with this, other times it errors out ...
Can you think of anything that would have changed from one run to another that might be impacting this?
Unfortunately no, in fact we have seen it happen locally where running it twice back-to-back will have different results
FYI we are working around this by regressing to the old style of JS interop. If there is anything I can do to tease out more information from dart analyzer or anything like that, please let me know.
I can't think of anything at the moment, but will let you know. @jacob314 Any ideas?
I'm currently seeing this consistently with 1.19.1, but not with 1.18.1.
@JS()
library session;
import 'package:js/js.dart';
@JS()
external void setSessionId(String sessionId);
Surprisingly, the analyzer returns errors for _both_ instances of @JS().
@travissanderson-wf as a workaround you can add the following to your .analysis_options file:
analyzer:
errors:
missing_js_lib_annotation: ignore
馃憤 you can also mark a specific problem line with an analyzer directive:
```
// ignore: missing_js_lib_annotation
Most helpful comment
@travissanderson-wf as a workaround you can add the following to your
.analysis_optionsfile: