getModified static method

Future<DateTime?> getModified(
  1. File file
)

Implementation

static Future<DateTime?> getModified(File file) async {
  if (!await isGitInstalled()) {
    return null;
  }
  if (!await isGitDir()) {
    return null;
  }

  // For already tracked files git returns date.
  // When file does not exists or is not yet tracked this returns empty string
  final result = await _shell.run(
    'git log --follow --format=%aI -1 -- ${file.path}',
  );

  return _parseOutput(result.outText);
}