I'm trying to use the webview package in my custom widget however I am unable to import it. I understand that this package already exists in flutterflow but I need to use the onMessageReceived function for some custom functionality.
Compilation Error in Custom Code
Launching lib/main.dart on Web Server in debug mode...
Waiting for connection from debug service on Web Server...
lib/custom_code/widgets/docu_seal_editor.dart:35:14: Error: The method 'WebView' isn't defined for the class '_DocuSealEditorState'.
import 'package:webview_flutter/webview_flutter.dart';
class DocuSealEditor extends StatefulWidget {
const DocuSealEditor({
Key? key,
this.width,
this.height,
}) : super(key: key);
final double? width;
final double? height;
@override
_DocuSealEditorState createState() => _DocuSealEditorState();
}
class _DocuSealEditorState extends State<DocuSealEditor> {
@override
Widget build(BuildContext context) {
return Container(
width: widget.width,
height: widget.height,
child: WebView(
initialUrl: 'about:blank',
onWebViewCreated: (WebViewController webViewController) {
webViewController.loadUrl(Uri.dataFromString(
'<html><body><p>This is a basic HTML page in WebView</p></body></html>',
mimeType: 'text/html',
encoding: Encoding.getByName('utf-8'))
.toString());
},
),
);
}
}