Saving Data in Flutter

Jan 31 2024 · Dart 3, Flutter 3.10, Visual Studio Code

Part 3: Reading & Writing Files

13. Creating the File List Screen (Part 2)

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 12. Creating the File List Screen (Part 1) Next episode: 14. Creating the File Screen

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

Let’s get to the design of our screen. In the build method, instead of the Placeholder, let’s return a Scaffold. In its appbar, let’s show a title with a Text widget containing the name of the list:

appBar: AppBar(title: Text(_listName)), 
body: FutureBuilder<List<FileSystemEntity>>( 
  future: _getFiles(), 
  builder:(context, snapshot) { 
  }, 
) 
if (snapshot.connectionState == ConnectionState.waiting) { 
  return const Center(child: CircularProgressIndicator()); 
} 
return Center(child: Text('Error: ${snapshot.error}')); 
final dateString = '${date.year}-${date.month}-${date.day}'; 
final size = file.lengthSync(); 
var subtitle = ''; 
if (_showSize) subtitle +=  'File size: ${size.toString()}'; 
if (_showDate) subtitle +=  'Last modified: $dateString'; 
return ListTile( 
  title: Text(file.path.split('/').last), 
  subtitle: Text(subTitle), 
  onTap: () {} 
);