---
slug: "flutter-downloader-crashed-when-initialize"
title: "The App Crashes When Using FlutterDownloader.initialize() with flutter_downloader"
description: "While using flutter_downloader 1.3.4 with Flutter, the app crashes at await FlutterDownloader.initialize() when debugging from Android Studio. However, the app does not crash when launched from XCode. If anyone knows how to fix this, please let me know."
url: "https://www.ytyng.com/en/blog/flutter-downloader-crashed-when-initialize"
publish_date: "2020-02-12T06:35:41Z"
created: "2020-02-12T06:35:41Z"
updated: "2026-02-27T05:14:48.762Z"
categories: []
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/d9f356ac5179438d80e2f4422e03ca73.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# The App Crashes When Using FlutterDownloader.initialize() with flutter_downloader

While using flutter_downloader 1.3.4 in Flutter,

In the main function:

```dart
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await FlutterDownloader.initialize();
  return runApp(MyApp());
}
```

When launching from Android Studio for debugging, the app crashes at `await FlutterDownloader.initialize();`.

However, the app does not crash when launched from XCode.

Additionally, it doesn't occur when stepping through the code line by line.

Not knowing how to resolve this, I tried:

```dart
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Future.delayed(Duration(milliseconds: 10));  // ← This line
  await FlutterDownloader.initialize();
  return runApp(MyApp());
}
```

After adding this, the app no longer crashes.

I don't think this is the proper solution, but I will proceed with this for the evaluation of flutter_downloader.

If anyone knows the proper way to handle this, please let me know. @ytyng
