question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FlutterDownloader.initialize() throw exception on open the downloadScreen again

See original GitHub issue

Flutter: 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:open
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ffahadMalikkcommented, Apr 17, 2020

You are initializing downloader every time your screen rendered so make a check if downloader already initialized don’t do it again.

0reactions
ffahadMalikkcommented, Feb 10, 2021

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found