Open fzyzcjy opened 2 years ago
A workaround is to use class SomeStore extends _SomeStoreBase with _$SomeStore {}
instead of class SomeStore = _SomeStoreBase with _$SomeStore;
. However, the next linting error then occurs in the .g.dart
file because a leading underscore is used for a local identifier (no_leading_underscores_for_local_identifiers
). So it seems that some code changes to MobX might be needed to satisfy these new linter rules.
Good idea!
However, the next linting error then occurs in the .g.dart
No worries: We can configure build runner to add //ignore_for_file
for .g.dart
No worries: We can configure build runner to add //ignore_for_file for .g.dart
How do you do that? Did you read it from a document or sth?
you can put the following code in the build.yaml
. I usually use it for ignoring code coverage from generated files
targets:
$default:
builders:
source_gen|combining_builder:
options:
preamble: |
// ignore_for_file: ...
There is a better and simple solution.
Either, for all the files in your projet:
Modify in analysis_options.yaml at the root of your project
rules:
library_private_types_in_public_api: false
Either, for a single file in your projet:
add the comment
// ignore: library_private_types_in_public_api
above the line with problem (although they says it can be at the start of the file, it doesn't work for me.
Hope this help.
Documentation of that lint: https://dart-lang.github.io/linter/lints/library_private_types_in_public_api.html
What do you think? Shall we let users to manually suppress this lint for each and every store? That sounds very verbose.