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

Question

Asked by BC T on November 21, 2021 (source).

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("[email protected]"),
          onTap: () {

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

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

Answer

Question answered by zeia s (source).

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

DART FLUTTER
SHARE: