Part of my CI/CD contains a flutter analyze. I get false depend_on_referenced_packages whenever I use great features of collection.dart.
Relevant sections of pubspec.yaml:
...
environment:
sdk: ">=2.17.1 <3.0.0"
flutter: ">=3.0.1"
...
dev_dependencies:
build_runner: ^2.1.11
floor_generator: ^1.2.0
flutter_driver:
sdk: flutter
flutter_lints: ^2.0.1
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
mockito: ^5.2.0
mock_data: ^2.0.0
Running:
$ flutter analyze
...
info • Depend on referenced packages • lib/preferences/palette_spec.dart:3:8 • depend_on_referenced_packages
info • Depend on referenced packages • lib/ui/parts/circular_menu.dart:5:8 • depend_on_referenced_packages
...
Source code examples:
database_utils.dart (firstWhereOrNull is from collection.dart):
...
import 'package:collection/collection.dart';
...
Activity? _getActivityById(int id) {
return activities.firstWhereOrNull((element) => element.id == id);
}
...
Record? _getRecordById(int id) {
return records.firstWhereOrNull((element) => element.id == id);
}
palette_spec.dart (forEachIndexed is from collection.dart):
...
import 'package:collection/collection.dart';
...
paletteStr.split(",").forEachIndexed((index, colorStr) {
...
});
circular_menu.dart:
...
import 'package:vector_math/vector_math.dart' as vector;
...
final angle = vector.radians(90.0 / (widget.children.length - 1) * index + angleFix);
The problem is to mute this I can add // ignore_for_file: depend_on_referenced_packages to the file but as I understand that would turn of this useful lint for other imports as well. I really like when the linter points out to me when I don't use an import any more.
Part of my CI/CD contains a
flutter analyze. I get falsedepend_on_referenced_packageswhenever I use great features ofcollection.dart.Relevant sections of
pubspec.yaml:Running:
Source code examples:
database_utils.dart(firstWhereOrNull is from collection.dart):palette_spec.dart(forEachIndexed is from collection.dart):circular_menu.dart:The problem is to mute this I can add
// ignore_for_file: depend_on_referenced_packagesto the file but as I understand that would turn of this useful lint for other imports as well. I really like when the linter points out to me when I don't use an import any more.