Using flutter_inner_drawer: ^1.0.0+1
I got a error thats is type
'List<Widget?>' is not a subtype of type 'List' in type cast
my code:
final GlobalKey<InnerDrawerState> _innerDrawerKey =
GlobalKey<InnerDrawerState>();
InnerDrawer(
key: _innerDrawerKey,
onTapClose: true, // default false
swipe: true, // default true
colorTransitionChild: Colors.red, // default Color.black54
colorTransitionScaffold: Colors.black54, // default Color.black54
//When setting the vertical offset, be sure to use only top or bottom
offset: const IDOffset.only(bottom: 0.05, right: 0.0, left: 0.0),
scale:
const IDOffset.horizontal(0.8), // set the offset in both directions
proportionalChildArea: true,
borderRadius: 50, // default 0
leftAnimationType: InnerDrawerAnimation.static,
rightAnimationType: InnerDrawerAnimation.quadratic,
backgroundDecoration: const BoxDecoration(
color: Colors.red), /
onDragUpdate: (double? val, InnerDrawerDirection? direction) {
print(val);
print(direction == InnerDrawerDirection.start);
},
innerDrawerCallback: (a) =>
print(a),
leftChild: Container(),
scaffold: Scaffold(
appBar: AppBar(automaticallyImplyLeading: false),
)
);
how can I salve this error?
This issue is coming from the source code. You can check the git Issue
The issue is coming from L435-L437
children
doesn't accept any nullable widget.Also,
_trigger(..)
method returning nullable widget L544-L563And It is being used on L600-L620
While the children can't be null anymore, we can remove or replace
_trigger()
widget when it returns null.You can solve by making children not nullable.
In that case
scaffoldChild
will benull check while using
_trigger(..)
or provide default value likeThere is an easy solution from others repo: you can follow this comment which says