Skip to content

Confusing "isn't a valid override" error #48468

Closed
@esDotDev

Description

@esDotDev

With code like this:

abstract class AbstractMixin {
  R? watch<T extends ValueListenable<R>, R>({
    T? target,
    String? instanceName,
  });
}

mixin Foo implements AbstractMixin {
  R? watch<T extends ValueListenable<R>, R>({
    T? target,
    String? instanceName,
  }) {
    return target?.value; // simplified implementation, 
  }
}

Gives this error:

error: 'Foo.watch' ('R Function<T extends ValueListenable<R>, R>({String? instanceName, T? target})') 
isn't a valid override of 'AbstractMixin.watch' ('R Function<T extends ValueListenable<R>, R>({String? instanceName, T? target})').

Not sure what the problem is?

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work ondart-model-analyzer-specIssues with the analyzer's implementation of the language speclegacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions