tryFetch method
Future<T?>
tryFetch({
- required DocumentReference<
Object?> ref, - Source source = Source.serverAndCache,
Same as RepositoryAddon.transform but will return a Future with
latest value in the DB using the given ref
.
If the given ref
is not found, this will return null
without
throwing any exception.
Implementation
Future<T?> tryFetch({
required DocumentReference ref,
Source source = Source.serverAndCache,
}) async {
try {
return await fetch(ref: ref, source: source);
// ignore: avoid_catches_without_on_clauses
} catch (e) {
return null;
}
}