MixinNetwork / MixinNetwork/flutter-plugins

I could not load a Blob from a URL in a web environment.

Open
#339 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

desktop_drop platform-web
Dominant language
C
Stars
512
Forks
292
Avg merge
15h 8m
Merged PRs (30d)
7

Description

When I use the following on the web, I get the following error

 Padding(
    padding:  const EdgeInsets.symmetric(vertical: 15),
    child: DropTarget(
      onDragDone: (detail) {
        onDragFile(detail.files);
      },
      child: Container(
          height: 180,
            color: dragging
                ? Colors.blue
                : Colors.black26,
            child: Center(
              child: Column(
                mainAxisAlignment:
                    MainAxisAlignment.center,
                children: <Widget>[
                  Text(
                    widget.title,
                    style: const TextStyle(
                      fontSize: 24,
                      fontWeight:
                          FontWeight.bold,
                    ),
                  ),
                  const SizedBox(height: 10),
                ],
              ),
            ),
          )
  )),

Future<void> onDragFile(List<XFile> files) async {
    for (final file in files) {
      try {
        Uint8List fileBytes = await file.readAsBytes();

        bool addedSuccessfully = await addFileWithTotalSizeAndCountCheck(
            fileBytes, file.name, false);
        if (!addedSuccessfully) {
          break;
        }
      } catch (e) {
        print('Error reading file ${file.name}: $e');
        break;
      }
    }
  }

Error reading file 2024-05-08 9.47.35.png: Exception: Could not load Blob from its URL. Has it been revoked?

Is there any solution?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the web drag-and-drop path shown in the issue, especially DropTarget and onDragFile, and reproduce the failure from file.readAsBytes(). Investigate why the Blob URL is unavailable; done means dragged files can be read successfully in the web environment without the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.