Skip to content

Null Check Operator #6

@eimmer

Description

@eimmer

I am building an AAR and Framework that is logic only and has no UI. Instead of the module starting a flutter view, I just call WidgetsFlutterBinding.ensureInitialized(); and then setup a channel. On the native Android side, I warm up the FlutterEngine in the app object as documented by Flutter. When I try to download a file, I get the following error.

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Null check operator used on a null value
    #0      Flowder.initDownload (package:flowder/src/flowder.dart:54:70)
    <asynchronous suspension>
    #1      Flowder.download (package:flowder/src/flowder.dart:29:28)
    <asynchronous suspension>

Here is my code snippet:

final downloaderUtils = DownloaderUtils(
  progressCallback: (current, total) {
    final progress = (current / total) * 100;
    print('Downloading: $progress');
  },
  file: File('$appDocPath/puppy.jpg'),
  progress: ProgressImplementation(),
  onDone: () => print('Download done'),
  deleteOnCancel: true,
);

final DownloaderCore core = await Flowder.download(
    _FILE_URL,
    downloaderUtils);

Here is my Flutter Doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.2, on macOS 11.5.2 20G95 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.53.2)
[✓] Connected device (3 available)

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions