Add this to your package's pubspec.yaml file:
1.9.1
dependencies:
flutter_filereader: ^1.0.0
1.12.x
dependencies:
flutter_filereader: ^2.2.0
2.0.0
dependencies:
flutter_filereader: 3.0.0
docx,doc,xlsx,xls,pptx,ppt,pdf,txt,jpg,jpeg,png
docx,doc,xlsx,xls,pptx,ppt,pdf,txt
Make sure you add the following key to Info.plist for iOS
<key>io.flutter.embedded_views_preview</key><true/>
import 'package:flutter/material.dart';
import 'package:flutter_filereader/flutter_filereader.dart';
class FileReaderPage extends StatefulWidget {
final String filePath;
FileReaderPage({Key: Key, this.filePath});
@override
_FileReaderPageState createState() => _FileReaderPageState();
}
class _FileReaderPageState extends State<FileReaderPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("doc"),
),
body: FileReaderView(
filePath: widget.filePath,
),
);
}
}