This plugin lets us use Apple QuickLook (QLPreviewController
).
import 'package:flutter/services.dart' show rootBundle;
import 'package:path_provider/path_provider.dart';
import 'package:quick_look/quick_look.dart';
...
final byteData = await rootBundle.load('assets/$path');
final String directory =
(await getApplicationDocumentsDirectory()).path;
final tempFile = await File('$directory/$path').writeAsBytes(
byteData.buffer.asUint8List(
byteData.offsetInBytes, byteData.lengthInBytes));
await QuickLook.openURL(tempFile.path);