Repository navigation
Description
I'm using flutter module in my existing iOS app. While making changes Text, I use hot reload to see the output. It was working bad, Whether I use an emulator or iphone.(only way it work fine,it‘s using ’flutter run‘ directly rather than using xcode run) its giving me the exception like this:
======== Exception caught by widgets library =======================================================
The following NoSuchMethodError was thrown building ContainerMain(dirty, state: _ContainerMain#f0c96):
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
example code:
void main() {
runZonedGuarded<Future<Null>>(() async {
runApp(ContainerMain(inApp: true, appType: global.AppType.xxxxx,));
}, (dynamic error, StackTrace stackTrace) async {
if (kReleaseMode) {
reportError(error, stackTrace);
}
});
}
class _ContainerMain extends State<ContainerMain> {
bool? inApp;
_ContainerMain({bool inApp = true}) {
this.inApp = inApp;
}
@override
void initState() {
if (!this.inApp!) {
super.initState();
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
// builder: Hybrid.init(),
home: Container(alignment: Alignment.center, child: Text("tetetet2"), color: Colors.yellow,),
);
}
}
evironment:
1、flutter
[✓] Flutter (Channel stable, 3.0.3, on macOS 12.5 21G72 darwin-x64, locale
zh-Hans-CN)
• Flutter version 3.0.3 at /Users/xxxxx/Documents/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 676cefa (8 weeks ago), 2022-06-22 11:34:49 -0700
• Engine revision ffe7b86a1e
• Dart version 2.17.5
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version
32.1.0-rc1)
• Android SDK at /Users/xxxxx/Library/Android/sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
11.0.12+0-b1504.28-7817840)
in flutter module
Activity
huycozy commentedon Aug 16, 2022
Hi @zerryzarax
From the logs:
It looks like it's caused by a syntax error. It should be
Text()rather thanText.().So, try correcting it to see if the issue is still reproducible. Thanks!
zerryzarax commentedon Aug 17, 2022
hi @huycozy
If it is like you said, the direct build should report an error, but the direct build can run normally, and the interface looks normal. And I use 'flutter attach' in the direct build mode of xcode, and then I just change 'Text("tetetet")' to 'Text("tetetet2"), and then use android studio to save the file to trigger hot reload. As a result, the above error was triggered. I suspect there is something wrong in xcode_backend.dart. Is it inconsistent with the code that android studio directly triggers flutter run?
thank you for your reply
zerryzarax commentedon Aug 18, 2022
At present, I have found a temporary adaptation solution:
exaby73 commentedon Aug 18, 2022
Hello @zerryzarax. Thank you for the information. Can you provide a minimal, reproducible example in the form of a public repository so that we can investigate this issue?
zerryzarax commentedon Aug 21, 2022
hi @exaby73 ,there is a bug demo,https://github.com/zerryzarax/flutter-3.0.3-bug-test-demo
exaby73 commentedon Aug 22, 2022
@zerryzarax I am unable to run the project you have provided. Could you provide some steps to run the project which has caused you to get this error?
zerryzarax commentedon Aug 22, 2022
@exaby73
The following are the steps to run the project:
huycozy commentedon Aug 23, 2022
Hi @zerryzarax, thanks for providing very detailed steps to reproduce.
This issue is reproducible on the latest
stableandmasterchannels. The sample code can be found at [Add2App] No constructor 'Text.' with matching arguments declared in class 'Text'. #109602 (comment).The issue is happening with
Hot reloadwhilstHot restartis working normally.This issue affects iOS side, it works normally on Android side with sample code at https://github.com/flutter/samples/tree/main/add_to_app/plugin
✅: No Issue ❌: Issue reproduced
Demo (screenshot)
Logs
flutter doctor -v
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.2.1 21D62 darwin-x64, locale en-VN) • Flutter version 3.0.5 at /Users/huynq/Documents/GitHub/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f1875d570e (9 hours ago), 2022-07-13 11:24:16 -0700 • Engine revision e85ea0e79c • Dart version 2.17.6 • DevTools version 2.12.2 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-33, build-tools 31.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.3) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2020.3.3) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart [✓] IntelliJ IDEA Community Edition (version 2022.1.1) • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart [✓] VS Code (version 1.69.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.44.0 [✓] Connected device (3 available) • SM T225 (mobile) • R9JT3004VRJ • android-arm64 • Android 11 (API 30) • macOS (desktop) • macos • darwin-x64 • macOS 12.2.1 21D62 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.114 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found![✓] Flutter (Channel master, 3.1.0-0.0.pre.2428, on macOS 12.5 21G72 darwin-x64, locale en-EE) • Flutter version 3.1.0-0.0.pre.2428 on channel master at /Users/huynq/Documents/GitHub/flutter_master • Upstream repository https://github.com/flutter/flutter.git • Framework revision 328545e5af (40 minutes ago), 2022-08-22 22:31:06 -0400 • Engine revision ca48808d06 • Dart version 2.19.0 (build 2.19.0-124.0.dev) • DevTools version 2.16.0 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-33, build-tools 31.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 13E113 • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2020.3.3) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart [✓] IntelliJ IDEA Community Edition (version 2022.1.1) • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart [✓] VS Code (version 1.70.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.46.0 [✓] Connected device (3 available) • iPhone 13 (mobile) • 2526BC1A-435D-4B08-B99C-44B928F2517B • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 12.5 21G72 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.101 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found!3 remaining items
[-]flutter 3.0.3, No constructor 'Text.' with matching arguments declared in class 'Text'.[/-][+][Add2App] No constructor 'Text.' with matching arguments declared in class 'Text'.[/+]jmagman commentedon Aug 23, 2022
Not sure why the
Stringarg isn't being passed through to the constructor, I can seeargumentsandargumentNamesis nil whenNoSuchMethodErroris thrown.This doesn't reproduce from the Flutter module, just from the embedded add-to-app case.
@rmacnak-google do you know what's going on here? https://dart-review.googlesource.com/c/sdk/+/143541
a-siva commentedon Sep 15, 2023
//cc @rmacnak-google a hot reload issue, though not sure why it should be an iOS only problem.
afradahsan commentedon Nov 16, 2023
I'm facing the issue on my android device.