create method

String create(
  1. String fid,
  2. User user
)

Implementation

String create(String fid, User user) {
  final dir = p.join(_root, historyDir, fid);
  final file = p.join(dir, 'createdInfo.json');
  final d = Directory(dir);
  if (!d.existsSync()) {
    d.createSync(recursive: true);
  }

  File(file).writeAsStringSync(json.encode({
    'created': now,
    'uid': user.id,
    'uname': user.name,
  }));
  return file;
}