Simply change the text
property
TextField(
controller: txt,
),
RaisedButton(onPressed: () {
txt.text = "My Stringt";
}),
while txt
is just a TextEditingController
var txt = TextEditingController();
More Related Contents:
- What is a Future and how do I use it?
- Is there a difference in how member variables are initialized in Dart?
- How to get height of a Widget?
- Flutter: How to correctly use an Inherited Widget?
- What is the difference between named and positional parameters in Dart?
- Passing Data to a Stateful Widget in Flutter
- How to upload images and file to a server in Flutter?
- How do you detect the host platform from Dart code?
- How to import platform specific dependency in Flutter/Dart? (Combine Web with Android/iOS)
- How to implement Dark mode and Light Mode in flutter?
- How do I do the “frosted glass” effect in Flutter?
- How to change the application launcher icon on Flutter?
- Flutter plugin not installed error; When running ‘flutter doctor’
- Flutter StreamBuilder vs FutureBuilder
- How to detect swipe in flutter
- Style BottomNavigationBar in Flutter
- Async/Await/then in Dart/Flutter
- TextField inside of Row causes layout exception: Unable to calculate size
- How to solve the “Type Null is not a subtype of type …” error?
- Vertical viewport was given unbounded height
- How can I layout widgets based on the size of the parent?
- Could not open settings generic class cache for settings file ‘
- How to run code after some delay in Flutter?
- Flutter: “RenderFlex children have non-zero flex but incoming height constraints are unbounded”
- How to use BottomNavigationBar with Navigator?
- InheritedWidget with Scaffold as child doesn’t seem to be working
- Flutter: List is deprecated? [duplicate]
- How can a named route have URL parameters in flutter web?
- How to pass callback in Flutter
- How to save and download text file in Flutter web application