Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null Children Should be Allowed #16935

Closed
agrosner opened this issue Apr 24, 2018 · 4 comments
Closed

Null Children Should be Allowed #16935

agrosner opened this issue Apr 24, 2018 · 4 comments

Comments

@agrosner
Copy link

Steps to Reproduce

class AppBuildInfoItem extends StatelessWidget {
  final BuildInfo buildInfo;

  AppBuildInfoItem(this.buildInfo);

  @override
  Widget build(BuildContext context) {
    return new ListTile(
        title: Padding(
            padding: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 8.0),
            child: Text("Build ${buildInfo.displayName}")),
        subtitle: Text(buildInfo.getDisplayTime()),
        trailing: Row(children: <Widget>[
          buildInfo.result != "SUCCESS" ? Text(buildInfo.result) : null,
          Platform.isAndroid ? null : Icon(Icons.chevron_right),
        ]));
  }
}

flutter: Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 1648 pos 14: '!children.any((Widget child) => child == null)': is not true.

We should be able to return null items in a Widget[] and the framework should just globally filter those out. This is useful coming from React, where this is completely valid.

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v0.3.3, on Mac OS X 10.13.4 17E199, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
[✓] Android Studio (version 3.0)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Android Studio (version 3.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1.1)
[✓] Connected devices (3 available)

• No issues found!

@StokeMasterJack
Copy link

Agreed. This makes a lot of coding scenarios easier. Which is why React works this way.

@lyquocnam
Copy link

hope this will done soon !

@zoechi
Copy link
Contributor

zoechi commented Aug 27, 2018

Closing as dup of #17862.
This one is older but the other has more discussion and upvotes.

@zoechi zoechi closed this as completed Aug 27, 2018
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Apr 9, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Apr 9, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Apr 9, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Apr 9, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Apr 9, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this issue Apr 10, 2020
@github-actions
Copy link

github-actions bot commented Sep 2, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants