I want to view file like pdf,doc,pptx and etc in my flutter app using url and I don't want to store any file in device - flutter

I want to view file like pdf,doc,pptx and etc in my flutter app using url and I don't want to store any file in device

You can use the flutter_webview_plugin package to display files in your Flutter app without downloading or storing them on the device. Here is an example of how to use it to display PDF files:
Add the flutter_webview_plugin package to your pubspec.yaml file and run flutter pub get to install it.
Import the package in your Dart code:
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
Use the WebviewScaffold widget to display the PDF file:
url: 'https://example.com/path/to/file.pdf',
withZoom: true,
withLocalStorage: true,
The url parameter should point to the URL of the PDF file you want to display. The withZoom and withLocalStorage parameters are optional and control whether the user can zoom in and out of the file and whether any local storage is used for caching.
You can use the same approach to display other types of files, such as Microsoft Office documents and PowerPoint presentations, as long as the file is accessible via a URL.


Flutter: Share fire directly (PDF)

It's possibile to share directly a Pdf file in flutter? I'm using Share_Plus plugin but it only support url or direct path.
My case:
Pdf uploaded on firebase
I retrive the URL
tried to use URI to file but I can't find the direct path to use with share_plus
The only solution is to save the file in the local storage of the phone and then retrieve di path and use with share_plus?
You can use Firebase Storage. Files are url-referable from there.
Read all about it here: https://firebase.google.com/docs/storage

How to save file temporarily in Flutter?

I want to save a download a video, save it into a temporary file that will automatically disappear when the app is closed. Is there a convenient way to do so in Flutter?
I'm aware that we can use path_provider package to generate a file in temporary folder, but that file will not disappear after user close the app.
try flutter_cache_manager, you can download the file in cache and remove it from cache:
getFileStream(url) returns a stream with the first result being the cached file and later optionally the downloaded file.
getFileStream(url, withProgress: true) when you set withProgress on true, this stream will also emit DownloadProgress when the file is not found in the cache.
downloadFile(url) directly downloads from the web.
getFileFromCache only retrieves from cache and returns no file when the file is not in the cache.
putFile gives the option to put a new file into the cache without downloading it.
removeFile removes a file from the cache.
emptyCache removes all files from the cache.
If you want to save anything in Flutter, i think key-value storing is the best way to do. In Flutter there is a package called shared_preferences which is help you to store key-value data on disc.
I copied the official websites of the shared_preferences package. On these websites you can read a lot about this.

How to open/find the file created by path_provider?

I'm a beginner at flutter and dart and had some issues with file handling using flutter.
I'm trying to store data locally in text files for my flutter application, and came across the standard tutorial on flutter's website which used path_provider and dart:io. It had instructions on getting the path and reading and writing to a file, however this didn't seem to work for files I added to the project. The only way to store to files was to first write using the inbuilt functions, then reading this newly created file. I can't add my own file and read it using flutter.
I also can't open the file created by flutter as I don't know where its stored. The path given by getApplicationDocumentsDirectory() returns the path /data/user/0/com.example.daily_challenges/app_flutter, and I don't know where to find this in my project.
In summary: How do I read a pre-existing file and how do I view the file created automatically by flutter.
Thanks :)
You can access the files from a physical device or simulator through Device File Explorer in Android Studio. Follow this guide
You won't be able to access getApplicationDocumentsDirectory().
If you are using android device, you can try to store it in getExternalStorageDirectory(). There's no equivalent in IOS though.
If you are running in a physical device. Open Device File Explorer in Android Studio and you can find the file under
data/data/your app package/app_flutter/fileName.txt
For example,
And if you want to read the pre-existing file, you not need to anything specific, if you give the same file name, if not exist, it will create one, otherwise it will return the old one.
final File file = File(filePath);
file.writeAsStringSync('${text}', mode: FileMode.append);
For write, you consider using FileMode if you want to append text to the existing file. Or else by default overwrite will happen.
For read, you can consider this
final File file = File(filePath);
String text = await file.readAsString();
Just use Device File Explorer from Android Studio.
But the weird thing, path_provider gives you path like /data/user/0/your_app_id/..., but in fact all files are located in /data/data/your_app_id/..., as mentioned in previous answer.

Download a flutter generated file

I want to download(or save to downloads) a pdf file that is generated by flutter using flutter_html_to_pdf: ^0.5.2.
Which package or method should I use?
Thanks for the response.

Show pdf in flutter

How can I show a PDF file in my application?
I have the URLs of the files that I need to open in my database, what I need is to show any of those files.
Is there any way to do this?