fluttercommunity / fluttercommunity/flutter_webview_plugin

Load local webpage from assets

Open
#349 11 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.5k
Forks
936
PR merge metrics
No merged PRs in 30d

Description

I try to load a local webpage from my assets:

new WebviewScaffold(
  url: "file:///assets/web/loesungen.html",
  allowFileURLs: true,
…

But if I open the view in Android emulator I get the error message:

The webpage as file:///assets/web/loesungen.html could not be loaded because:
net::ERR_FILE_NOT_FOUND

The assets webpage is correct included in pubspec.yaml and I can load the webpage with:

final htmlData = await rootBundle.loadString('assets/web/loesungen.html');

I user Flutter 1.2.1, Dart 2.1.2 and flutter_webview_plugin 0.3.0

Any ideas why it’s not work?

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

Reproduce the failure from the WebviewScaffold example on the Android emulator, comparing the file:///assets/web/loesungen.html URL with the rootBundle.loadString('assets/web/loesungen.html') entry point. Read the asset declaration in pubspec.yaml and the plugin's Android WebView handling; done means identifying whether this asset URL is supported and documenting or correcting the loading path.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart, flutter
Domain
mobile-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.