in app webview

It looks like there has been an update to the flutter_inappwebview package which now expects a WebUri instead of a Uri.

Here's the corrected code:

  1. Add the flutter_inappwebview package to your pubspec.yaml file:
yaml
dependencies: flutter: sdk: flutter flutter_inappwebview: ^6.0.0
  1. Import the package in your Dart file:
dart
import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart';
  1. Create a WebView widget to display the web content:
dart
class WebViewScreen extends StatefulWidget { @override _WebViewScreenState createState() => _WebViewScreenState(); } class _WebViewScreenState extends State<WebViewScreen> { InAppWebViewController? webViewController; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('WebView Example'), ), body: InAppWebView( initialUrlRequest: URLRequest( url: WebUri('https://web.footballislife.xyz:8443/tntsports2.php'), ), onWebViewCreated: (controller) { webViewController = controller; }, onLoadStop: (controller, url) async { print("Finished loading: $url"); }, onLoadError: (controller, url, code, message) { print("Error loading: $message"); }, onLoadHttpError: (controller, url, statusCode, description) { print("HTTP error: $statusCode, $description"); }, ), ); } }
  1. Use the WebViewScreen widget in your application:
dart
void main() { runApp(MaterialApp( home: WebViewScreen(), )); }
Rakibul hasan

I am Rakibul hasan,Front and Back-End Developer.I am also good at database like mysql,Firebase,mssql. I'm a Workaholic Person and I love my job as a mobile application developer i never get tired for it. Its been always fasinating to me working for new creation. I am very passionate about my work.I do my job passionately and dedicatedly.I try to do my project with clean code and gather efficiency. The greatest quality of mine is patience.I can code all day long. I never feel bored during coding and i can't take rest until my code is completed.I can adapt anything very quickly. I am also very sincere,responsible,hard working and confident regarding my works.Each and Every Project is important to me and I like to take Challenge.

Post a Comment

Previous Post Next Post