Jude Okoroafor
Jude Okoroafor

Reputation: 484

How do i get flutter to display the content of a text file

I'm trying to get the names and the context of some text file to display to screen, so when the file name is clicked it opens a page displaying the full context of the selected file

I've google this for months now but found no help

Upvotes: 0

Views: 838

Answers (1)

erluxman
erluxman

Reputation: 19385

This doc looks pretty straight forward: https://flutter.dev/docs/cookbook/persistence/reading-writing-files#2-create-a-reference-to-the-file-location

TLDR;

  1. Find the path of the file.
  2. Initialize File with that path.
  3. Read the file as a string.
  4. Parse that string as per your need.

Upvotes: 1

Related Questions