2

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

2
  • You are giving a list that is null. It's the null safety question mark. Commented Nov 21, 2021 at 11:32
  • How we can handle it? Commented Nov 21, 2021 at 14:02

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

5 Comments

it's my pleasure.
How we can handle it without removing "?" and adding child! to the connectivity_wrapper class?
you can disable null safety in your flutter.flutter run --no-sound-null-safety
or you can use another version of the package. and look at docs here: dart.dev/null-safety/unsound-null-safety
Sure will read.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.