redirect_to_missing_constructor
The constructor '{0}' couldn't be found in '{1}'.
Description
#The analyzer produces this diagnostic when a constructor redirects to a constructor that doesn't exist.
Example
#The following code produces this diagnostic because the factory constructor in A
redirects to a constructor in B
that doesn't exist:
dart
class A {
factory A() = B.name;
}
class B implements A {
B();
}
Common fixes
#If the constructor being redirected to is correct, then define the constructor:
dart
class A {
factory A() = B.name;
}
class B implements A {
B();
B.name();
}
If a different constructor should be invoked, then update the redirect:
dart
class A {
factory A() = B;
}
class B implements A {
B();
}
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-05-08. View source or report an issue.