TransWikia.com

Import a list of string from another file in flutter

Stack Overflow Asked by Wytex System on December 11, 2021

I would create a class with a list of string in flutter on a another file and import this file to a main file that I am working…. for example:

class OrderDetails {

  final email = 'Email';
  final name = 'Mario';
  final city = 'Milano';

}

have this class into a file called details.dart
and import these strings to another main file

One Answer

 details.dart

class OrderDetails {
  static final email = 'Email';
  static final name = 'Mario';
  static final city = 'Milano';
}

import this file to that file where you want to use this file using

 import '/your_file_path/details.dart';

now use those value like this

 OrderDetails.email etc

Answered by Neeraj Amoli on December 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP