stat method
Metadata for path (never throws for a missing path — returns
exists: false).
Implementation
@override
Future<RepoStat> stat(String path) async {
final p = normalizeRepoPath(path);
final content = _files[p];
if (content != null) {
return RepoStat(
path: p,
exists: true,
isDir: false,
size: content.length,
lineCount: splitLines(content).length,
);
}
// A directory exists if any file is under it.
final isDir = _files.keys.any((f) => f.startsWith('$p/'));
return RepoStat(
path: p,
exists: isDir,
isDir: isDir,
size: 0,
lineCount: 0,
);
}