getDocumentInfo method

Future<Map<String, dynamic>> getDocumentInfo(
  1. String host,
  2. String docId
)

Get document metadata.

host - The host server URL. docId - The ID of the document.

Returns a Map<String, dynamic> containing document metadata.

Implementation

Future<Map<String, dynamic>> getDocumentInfo(
    String host, String docId) async {
  final url = '$host/api/storage/documents/$docId';
  try {
    final response = await http.get(Uri.parse(url));
    return json.decode(response.body);
  } catch (error) {
    return {};
  }
}