简体   繁体   中英

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? I need to get strings from different dart files in a dart file.

Suppose this is the file system of Your project.

探险家

  • CS.dart and CU.dart are the files where Strings is defined.
  • You want to use that Strings in the CategoryScreen.dart file.

Then you have to write these lines of code in your CategoryScreen.dart at the top of any other code.

import 'package:demo_app/utils/CS.dart';
import 'package:demo_app/utils/CU.dart';

...REST OF YOUR CODE HERE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM