← Back to Developer Blog
WebView

Flutter WebView Guide: Navigation, Errors and Multiple Screens

A practical guide based on my work with MultiPower - Multi WebView.

This article documents how I approach the feature in a real application: the implementation decision, the failure cases I check, and the release test I use before considering the work complete.

Controller setup

MultiPower - Multi WebView loads several web screens and also uses mobile advertising. During development I found that browser lifecycle, device resources, ad loading and signed release configuration have to be treated as separate concerns. A debug build proving that a screen works does not prove that a Play-delivered production build uses the same signing identity or ad configuration. When I work on controller setup, I first decide which layer owns the responsibility. Flutter should handle presentation and interaction, while protected business decisions are checked by the server or platform configuration that actually controls them. This separation prevents a UI workaround from hiding a backend or release problem.

I deliberately test failure paths for controller setup. Network timeout, empty data, invalid input, cancelled authentication, unavailable advertising, or a rejected API request should result in a controlled screen state. The application should not show an endless loader or silently save incomplete information simply because the successful path was the only one tested.

URL validation

For url validation, I capture the exact state before editing code: input values, user identifier, date range, HTTP status or native error, raw response where safe, and whether the failure happens in debug, locally signed release, or a build installed from Google Play. That evidence usually narrows the problem much faster than changing several files at once.

Another important check is consistency. If the backend calculates a salary period one way but a Flutter history screen sends another month range, both pieces of code may be individually valid while the user sees the wrong result. I therefore compare the parameters and business rules end to end before changing the visual layer.

final controller = WebViewController()
  ..setJavaScriptMode(JavaScriptMode.unrestricted)
  ..setNavigationDelegate(NavigationDelegate(
    onPageStarted: (_) {},
    onPageFinished: (_) {},
  ));

Loading states

I deliberately test failure paths for loading states. Network timeout, empty data, invalid input, cancelled authentication, unavailable advertising, or a rejected API request should result in a controlled screen state. The application should not show an endless loader or silently save incomplete information simply because the successful path was the only one tested.

After a fix, I repeat the original failing workflow rather than accepting a successful compilation as proof. For Play-specific behavior I test the Play-delivered artifact; for API problems I verify the real production endpoint; and for data problems I compare the returned JSON with the model used by the screen.

Back navigation

Another important check is consistency. If the backend calculates a salary period one way but a Flutter history screen sends another month range, both pieces of code may be individually valid while the user sees the wrong result. I therefore compare the parameters and business rules end to end before changing the visual layer.

MultiPower - Multi WebView loads several web screens and also uses mobile advertising. During development I found that browser lifecycle, device resources, ad loading and signed release configuration have to be treated as separate concerns. A debug build proving that a screen works does not prove that a Play-delivered production build uses the same signing identity or ad configuration. When I work on back navigation, I first decide which layer owns the responsibility. Flutter should handle presentation and interaction, while protected business decisions are checked by the server or platform configuration that actually controls them. This separation prevents a UI workaround from hiding a backend or release problem.

Multiple WebViews

After a fix, I repeat the original failing workflow rather than accepting a successful compilation as proof. For Play-specific behavior I test the Play-delivered artifact; for API problems I verify the real production endpoint; and for data problems I compare the returned JSON with the model used by the screen.

For multiple webviews, I capture the exact state before editing code: input values, user identifier, date range, HTTP status or native error, raw response where safe, and whether the failure happens in debug, locally signed release, or a build installed from Google Play. That evidence usually narrows the problem much faster than changing several files at once.

Performance and security

MultiPower - Multi WebView loads several web screens and also uses mobile advertising. During development I found that browser lifecycle, device resources, ad loading and signed release configuration have to be treated as separate concerns. A debug build proving that a screen works does not prove that a Play-delivered production build uses the same signing identity or ad configuration. When I work on performance and security, I first decide which layer owns the responsibility. Flutter should handle presentation and interaction, while protected business decisions are checked by the server or platform configuration that actually controls them. This separation prevents a UI workaround from hiding a backend or release problem.

I deliberately test failure paths for performance and security. Network timeout, empty data, invalid input, cancelled authentication, unavailable advertising, or a rejected API request should result in a controlled screen state. The application should not show an endless loader or silently save incomplete information simply because the successful path was the only one tested.

My troubleshooting workflow

Another important check is consistency. If the backend calculates a salary period one way but a Flutter history screen sends another month range, both pieces of code may be individually valid while the user sees the wrong result. I therefore compare the parameters and business rules end to end before changing the visual layer.

After a fix, I repeat the original failing workflow rather than accepting a successful compilation as proof. For Play-specific behavior I test the Play-delivered artifact; for API problems I verify the real production endpoint; and for data problems I compare the returned JSON with the model used by the screen.

What this project taught me

The main lesson from MultiPower - Multi WebView is that production behavior depends on more than Dart code. Signing certificates, package names, API endpoints, database filters, SDK configuration and store settings are all part of the application. I keep those values in a release checklist and verify the distribution that users will actually install.

Version note: Flutter packages, Android tools, Firebase, Google Play and advertising services change. Check current official documentation before applying version-specific configuration to a production release.