solid_lints
solid_lints copied to clipboard
Using avoid_using_api for extension methods.
I want to prohobit the usage of Iterable<Future<T>>'s wait getter, but can't seem to find a way to match it. Here is the definition in dart:async:
extension FutureIterable<T> on Iterable<Future<T>> {
Future<List<T>> get wait { /* ... */ }
}
I tried:
custom_lint:
rules:
- avoid_using_api:
severity: info
entries:
- class_name: FutureIterable<T> // but also FutureIterable<dynamic, FutureIterable, Iterable, Iterable<Future>, Iterable<Future<dynamic>>, Iterable<Future<T>>
identifier: wait
source: dart:async
reason: "Iterable.wait should be avoided because it loses type
safety for the results. Use a Record's `wait` method
instead."
severity: warning
but to no success. Without specifiying the class_name works but does match the (f1,f2).wait getter method I don't want to match.
@getBoolean have you tried anything like that?
I haven't tested against extension methods, it might not be handled properly by the current implementation. I'll look into it.