Saving Data in Flutter

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

Part 3: Reading & Writing Files

15. Polishing the App

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: 14. Creating the File Screen Next episode: 16. Using JSON (Part 1)

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.

In this moment our app is not really complete: we cannot access the settings screen, and we have to way to delete a file once it’s been created. And there’s also something more we can do: we can leverage JSON for our settings, as this may prevent errors, is commonly used, especially in other databases, and it’s generally considered a best practice.

actions: <Widget>[ 
            IconButton( 
              icon: const Icon(Icons.settings), 
              onPressed: () { 
                Navigator.push<dynamic>( 
                  context, 
                  MaterialPageRoute<dynamic>( 
                      builder: (context) => const SettingsScreen()), 
                ); 
              }, 
            ), 
          ], 
actions: [ 
  IconButton( 
    icon: const Icon(Icons.delete), 
    onPressed: () { 
      _deleteFile().then((value) { 
        Navigator.pop(context); 
      }); 
    }, 
  ) 
] 
  void _showMessage() {
    if (_statusMessage != '') {
      final snackBar = SnackBar(content: Text(_statusMessage));
      ScaffoldMessenger.of(context).showSnackBar(snackBar);
      _statusMessage = '';
    }
  }
final fileName = file.path.split('/').last; 
return Dismissible( 
  key: Key(fileName), 
  onDismissed: (direction) { 
    final fileHelper = FileHelper(); 
    fileHelper.deleteFile(fileName).then((dynamic _) { 
      setState(() {}); 
    }); 
  },