'How to use local variable of main function globally

Currently,

List<String> ls = List.filled(10, "0");

Future<void> main() async {
  final Directory localStorageDirectory = await getApplicationDocumentsDirectory();

//then assign the file.readAsLines() to ls;
}

Can I,

not declare(and initialize) the variables before the main function,

but use the local variables of main function, globally(in rest all program)...

Thanking you...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source