Type 'List<Widget?>' is not a subtype of type 'List<Widget>'

I’m using connectivity_wrapper: ^1.0.6 in flutter application. while passing child to connectivity_wrapper it generates an error type ‘List<Widget?>’ is not a subtype of type ‘List’ in type cast I have googled it but not able to find any solution. and also want to know the difference between List<Widget?> and ‘List.

@override
Widget build(BuildContext context) {
return Scaffold(
  appBar: appBarCustom(
    onBackTap: onBackTab,
    color: Colors.black,
    title: Strings.appName,
    textStyle: TextStyles.appBarBold,
    actions: [
      C0(),
    ],
  ),
  body: ConnectivityWidgetWrapper(
    child: ListView(
      children: <Widget>[
        ListTile(
          title: Text("EX1"),
          onTap: () {

          },
        ),
        Divider(),
        ListTile(
          title: Text("EX@"),
          onTap: () {

          },
        ),
        Divider(),
      ],
    ),
  ),
);
}

Error: type ‘List<Widget?>’ is not a subtype of type ‘List’ in type cast

>Solution :

there is an issue in github.so track that issue to solve your problem.
it’s all about null safety.

Leave a Reply