Skip to content

Using avoid_using_api for extension methods. #156

@gaetschwartz

Description

@gaetschwartz

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.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions