File Handling in Dart: Chapter Overview

File Handling teaches you to save data and share it with other programs.

In this chapter, you will:

  • read, write and append files, and work with folders using dart:io
  • turn Dart objects into JSON text and back with dart:convert
  • parse outside data safely, with model classes and patterns

What each lesson covers:

  • File Handling: How to read and write files and folders with dart:io, and how to save and load data as JSON with dart:convert, model classes and safe parsing.

This chapter has 1 lesson. Plan on about 31 minutes, with 6 exercises to check what you learned. Every example is real Dart code: change it, run it again and compare the output, which is the fastest way to learn how each feature behaves.

Simple lesson: finish this chapter and your programs can remember things and talk to servers.

Lessons in this section

  1. File Handling

    How to read and write files and folders with dart:io, and how to save and load data as JSON with dart:convert, model classes and safe parsing.

    • Read, write and append files, and work with folders
    • Handle FileSystemException
    • Encode and decode JSON with model classes, and parse it safely