get method
Reads the document referenced by this DocumentReference.
If no document exists, the read will return null
.
Implementation
Future<DocumentSnapshot?> get() async {
final response = await service._get(documentUri);
int httpStatusCode = response.statusCode;
if (httpStatusCode == HttpStatus.ok) {
Map<String, dynamic> jsonResponse =
json.decode(response.body) as Map<String, dynamic>;
_id = jsonResponse['id'] as int;
return DocumentSnapshot._(path, jsonResponse);
} else {
return null;
}
}