import 'package:path_provider/path_provider.dart';
import 'dart:io';

class FileStorage {
  Future<String> _path(String file) async {
    return "${(await getApplicationDocumentsDirectory()).path}/$file";
  }

  Future<void> write(String name, String content) async {
    await File(await _path(name)).writeAsString(content);
  }

  Future<String> read(String name) async {
    return await File(await _path(name)).readAsString();
  }

  Future<bool> exist(String name) async {
    return File(await _path(name)).exists();
  }
}