Skip to content

avoid_unnecessary_return_variable triggers when type promotion is needed #226

Description

@andrew-bekhiet-solid
T get<T>(String key) {
  final value = _map[key];
  
  if (value is T) {
    // local variable is promoted to T
    return value;
  }

  throw Exception('value is not of type $T');
}

Expected behavior

No lint

Actual behavior

The lint rule is triggered

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions