linter
linter copied to clipboard
Linter for Dart.
In the absence of a good way to copy immutable objects with some field changes, the Flutter team often implements a `copyWith` function that copies the original object with optional...
suggest all member functions that can be `static` # example ``` class foo { void foo(String a) { print(a); } } ``` suggest: ``` class foo { static void foo(String...
## unnecessary_super ## Description Don't use `super.` to refer to a member which is not overridden by the current class, just use ``. ## Details An unnecessary `super.` invocation can...
It seems when the user is encountered with [cast_nullable_to_non_nullable](https://dart-lang.github.io/linter/lints/cast_nullable_to_non_nullable.html) ```dart void f(Map json) { String s = json['a'] as String; } ``` there is a tendency to write ```dart String...
I'm proposing here that `avoid_positional_boolean_parameters` could be ignored in function-only-parameter cases. ## Bad Examples ```dart Task(true); Task(false); ListBox(false, true, true); Button(false); //New Case: Task.doSomething(object, true); ``` ## Good Examples ```dart...
**Describe the issue** Right now this very simple pattern isn't flagged: ```dart int getAge() { final age = ageCalculator(); return age; } ``` This could be flagged and quick-fixed to:...
The advice in `test_types_in_equals` is: ```dart @override bool operator ==(Object other) { if (identical(this, other)) { return true; } return other is Good && this.someField == other.someField; } ``` ...however,...
## `use_of_instead_of_from` ## Description The `from` ctor on collections is more expensive. It does casts. If possible, use the `of` constructor. ## Details If the source collection has a known,...
With the following code: ```dart extension type MapType._(JSObject _) implements JSObject { @JS('f') external void _f(); void Function() get f => () => _f(); } ``` a lint `unnecessary_lambdas` appears...