[英]How to pass strings from multiple dart files and get it to one dart file in flutter?
How to send the data's of different dart files to one dart file in flutter?如何将不同dart文件的数据发送到flutter中的一个dart文件中? I need to get strings from different dart files in a dart file.
我需要从 dart 文件中的不同 dart 文件中获取字符串。
Suppose this is the file system of Your project.假设这是您项目的文件系统。
CS.dart
and CU.dart
are the files where Strings is defined. CS.dart
和CU.dart
是定义字符串的文件。CategoryScreen.dart
file.CategoryScreen.dart
文件中使用该字符串。 Then you have to write these lines of code in your CategoryScreen.dart
at the top of any other code.然后,您必须在任何其他代码顶部的
CategoryScreen.dart
中编写这些代码行。
import 'package:demo_app/utils/CS.dart';
import 'package:demo_app/utils/CU.dart';
...REST OF YOUR CODE HERE
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.