getDocument method Null safety

Future<SchemaDocument?> getDocument(
  1. String cid
)

Retrieves a SchemaDocument from the Bucket

Implementation

Future<SchemaDocument?> getDocument(String cid) async {
  if (!_isInitialized) {
    await _resolve();
  }
  final content = await MotorFlutterPlatform.instance.getBucketObject(did, cid);
  if (content == null) {
    return null;
  }
  try {
    final item = BucketItem.fromBuffer(content.item);
    return item.getSchemaDocument();
  } catch (e) {
    return null;
  }
}