FlutterDownloader.initialize() throw exception on open the downloadScreen again
See original GitHub issueFlutter: 1.12.13+hotfix.8 IDE: VSCode
How to check if the plugin is already initialize? I have read about #154 but I cannot get how to do it.
I have a screen page let’s called it downloadScreen.dart
. On initState
, I will call a Future method to initialize the plugin based from the documentation part
WidgetsFlutterBinding.ensureInitialized();
await FlutterDownloader.initialize();
Note: the plugin must be initialized before using.
If I’m pop the downloadScreen and push back the screen at homeScreen, the run will be exception with FlutterDownloader.initialize() must be called only once!
How to check on initState
the plugin has already been initialized?
I’m using VSCode writing for Android device only.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
An eexception occurs when using flutter_downloader package
The error message is saying that you have tried to call FlutterDownloader.initialize() more than once. If your code represents a download button ...
Read more >flutter_downloader | Flutter Package - Pub.dev
Fix FlutterDownloader.open() always returning false (#726) ... iOS: fix NSRangeException being thrown when columns in the database don't match (#661) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You are initializing downloader every time your screen rendered so make a check if downloader already initialized don’t do it again.
I got a solution by checking count reference for the downloader Object.
1- Initialize the downloader at top level 2- While moving on download screen just check if the downloader alreayd initilize then don’t initilize it (use old reference)
It will resolve the issue