read static method

List<String> read(
  1. String group,
  2. String path,
  3. String prefixNameReplaceFile
)

Implementation

static List<String> read(
  String group,
  String path,
  String prefixNameReplaceFile,
) {
  final file = '${prefixNameReplaceFile}_scripts_trigger.json';
  var root = '.ft_cli';

  path = normalize(ReservedWords.removeWordsInFile(
    fileString: '$group/$path',
  ));

  var existFile = File('$root/$path/$file').existsSync();

  if (!existFile) {
    DirectoryUtils.create(root + '/' + path);

    File('$root/$path/$file').writeAsStringSync(json.encode([]));
  }

  return (json.decode(
    File('$root/$path/$file').readAsStringSync(),
  ) as List)
      .map((e) => e.toString())
      .toList();
}