Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shinpeiyamagiwa opened this issue May 11, 2024 · 0 comments
Open

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

shinpeiyamagiwa opened this issue May 11, 2024 · 0 comments
Labels
desktop_drop plugin desktop_drop platform-web

Comments

@shinpeiyamagiwa
Copy link

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?

@boyan01 boyan01 added desktop_drop plugin desktop_drop platform-web labels Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop_drop plugin desktop_drop platform-web
Projects
None yet
Development

No branches or pull requests

2 participants