getDocumentContentAsString function

Future<String?> getDocumentContentAsString(
  1. Uri uri, {
  2. bool throwIfError = false,
})

Helper method to read document using getDocumentContent and get the content as String instead as Uint8List.

Implementation

Future<String?> getDocumentContentAsString(
  Uri uri, {
  bool throwIfError = false,
}) async {
  final bytes = await getDocumentContent(uri);

  if (bytes == null) return null;

  return String.fromCharCodes(bytes);
}