[X] I give permission for members of the FlutterFlow team to access and test my project for the sole purpose of investigating this issue.
Current Behavior
I'm trying to use the webview package in my custom widget however I am unable to import it. I got this error:
The method 'WebView' isn't defined for the type '_CustomWebViewState'. Try correcting the name to the name of an existing method, or defining a method named 'WebView'.
Example code:
// Automatic FlutterFlow imports
import '/backend/supabase/supabase.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/widgets/index.dart'; // Imports other custom widgets
import '/custom_code/actions/index.dart'; // Imports custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom widget code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
import 'package:webview_flutter/webview_flutter.dart'; // Import the webview_flutter package
I did this because I want Facebook pages to load in my app, but I need to change the user agent for it. I tried "bypass domain restriction," but it doesn't work.
Steps to Reproduce
1:Create new widget and try to use webview.
Reproducible from Blank
[X] The steps to reproduce above start from a blank project.
- FlutterFlow version: FlutterFlow v4.1.59+ released June 12, 2024
Flutter version is 3.19.1
- Platform: Web and mobile
- Browser name and version: ungoogled-chromium 125.0.6422.60-3
- Operating system and version affected: Arch Linux
Can we access your project?
Current Behavior
I'm trying to use the webview package in my custom widget however I am unable to import it. I got this error:
The method 'WebView' isn't defined for the type '_CustomWebViewState'. Try correcting the name to the name of an existing method, or defining a method named 'WebView'.
Example code:
// Automatic FlutterFlow imports import '/backend/supabase/supabase.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/custom_code/widgets/index.dart'; // Imports other custom widgets import '/custom_code/actions/index.dart'; // Imports custom actions import '/flutter_flow/custom_functions.dart'; // Imports custom functions import 'package:flutter/material.dart'; // Begin custom widget code // DO NOT REMOVE OR MODIFY THE CODE ABOVE!
import 'package:webview_flutter/webview_flutter.dart'; // Import the webview_flutter package
class CustomWebView extends StatefulWidget { const CustomWebView({ super.key, this.width, this.height, required this.url, });
final double? width; final double? height; final String url;
@override State createState() => _CustomWebViewState();
}
class _CustomWebViewState extends State {
late WebViewController _controller;
@override Widget build(BuildContext context) { return Container( width: widget.width, height: widget.height, child: WebView( initialUrl: widget.url, ), ); } }
Expected Behavior
I did this because I want Facebook pages to load in my app, but I need to change the user agent for it. I tried "bypass domain restriction," but it doesn't work.
Steps to Reproduce
1:Create new widget and try to use webview.
Reproducible from Blank
Bug Report Code (Required)
IT4WkvHl4ZNPm+kF7aXybfpanSQUJj8ia6xNm8N+SkwYJZz2BJwPXPykP1doTcOiTFZYMFv8knEJzMrTvs7LGOQHAzWtc6ZFzqgIEArgfE66VYSzDoeOPERtEcdRNEuV5MOFqxBNHPdpSEYm6k2AIdivf3bXJJzSPTE7QeaXLt7AnnfhAi+6Xn0Jg1ZSfCvr
Visual documentation
Environment
Additional Information
No response