I' am new to flutter. I am using ListView.builder inside a NestedScrollView to hide my top AppBar and floating action button. AppBar and floating action button hides as required. I want to use InAppWebView to display web content. However, there is a problem with the InAppWebView widget, and I can't seem to get it work. In the following code, when I run my app, I get the error "Null check operator used on a null value".
NestedScrollView(
floatHeaderSlivers: true,
controller: _scrollController,
headerSliverBuilder: (context, innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle:
NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverSafeArea(
sliver: SliverAppBar(
title: Text(widget.title),
floating: true,
snap: false,
),
),
)
];
},
body: NotificationListener<UserScrollNotification>(
onNotification: (notification) {
final ScrollDirection direction = notification.direction;
setState(() {
if (direction == ScrollDirection.reverse) {
_isVisible = false;
} else if (direction == ScrollDirection.forward) {
_isVisible = true;
}
});
return true;
},
child: ListView.builder(
itemCount: 1,
itemBuilder: (context, index) => Column(
children: [
Expanded(
child: InAppWebView(
initialUrlRequest: URLRequest(
url: Uri.https('google.com', widget.path),
),
),
)
],
),
),
),
),
When I remove the "Expanded" function that is wrapping my InAppWebView widget, the app just crashes. Can someone please help me be able to display my web content using the InAppWebView? All suggestions are appreciated. Thanks!