run method
Runs this command.
The return value is wrapped in a Future if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
Future<void> run() async {
di<ValueMapper>().init(
bytesPrefix: getArgBytesPrefix(argResults),
locationPrefix: getArgLocationPrefix(argResults),
referencePrefix: getArgReferencePrefix(argResults),
datetimePrefix: getArgDateTimePrefix(argResults),
);
di<DocumentMapper>().init(metaPrefix: getArgMetaPrefix(argResults));
final firestore = await initFirestore(
project: getArgProject(argResults),
database: getArgDatabase(argResults),
usage: usage,
);
final restArgs = argResults!.rest;
checkHaveOnlyOneArg(restArgs: restArgs, usage: usage);
final relPath = restArgs.single;
final docJson = await firestore.getDocument(
documentPath: relPath,
includeSubcollections: getArgSubcollections(argResults),
);
final jsonOut = jsonEncoder.convert(docJson);
await writeToOut(jsonOut, fileName: getArgOut(argResults));
}