No constructor 'Text.' with matching arguments declared in class 'Text'
3,636
I also faced a similar error, but it resolved when I hot restart
the app instead of hot reload
.
Author by
iAkshay
Passionate about bringing an ideas into mobile apps :)
Updated on December 22, 2022Comments
-
iAkshay over 1 year
I'm using flutter module in my existing iOS app. While making changes I often use hot reload to see the output. It was working fine until yesterday, but when I use hot reload now, its giving me the exception:
The following NoSuchMethodError was thrown building PurchaseOrders(dirty, dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#4a83e]], state: _PurchaseOrdersState#a115b): No constructor 'Text.' with matching arguments declared in class 'Text'. Receiver: Text Tried calling: new Text.() Found: new Text.(String, {Key key, TextStyle style, StrutStyle strutStyle, TextAlign textAlign, TextDirection textDirection, Locale locale, bool softWrap, TextOverflow overflow, double textScaleFactor, int maxLines, String semanticsLabel, TextWidthBasis textWidthBasis, TextHeightBehavior textHeightBehavior}) => Text Widget creation tracking is currently disabled. Enabling it enables improved error messages. It can be enabled by passing `--track-widget-creation` to `flutter run` or `flutter test`.
I've tried: File -> Invalidate Caches/Restart. But didn't help me out. I have to stop and run every time I make any small change. What could be the issue ?
-
Petr Blahos almost 4 yearsThe error says you are calling Text() constructor without parameter but you should be calling Text("text"). Are you sure you did not remove the parameter by mistake?
-
iAkshay almost 4 yearsNo. Its working fine with normal run, but the issue is with hot reload.
-
MαπμQμαπkγVπ.0 over 2 yearsAre you running your app in
flutter beta
? Can you please provide yourflutter doctor -v
with latest stable, yourflutter attach --verbose
and a complete reproducible minimal code sample? It seems that this GitHub post is related to your issue.
-