Skip to content

Remove an assertion from CupertinoTabBar widget #42430

Closed
flutter/packages
#12546

Description

@genert

Use case

When using CupertinoTabBar, it has an assertion that property "items" must consist 2 items at least.

See

"Tabs need at least 2 items to conform to Apple's HIG",

Therefore when single item exists (we have a legitimise use case for that), the widget's assertion will fail resulting whole screen being bloody red in debug.

Proposal

I do not think Cupertino widgets should error when something does not conform to Apple's HIG. Warning message yes, but error? No thanks.

Therefore, I propose to remove the assertion and warn or log down for developer instead.

Activity

  1. added
    p: cupertino_uicupertino_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Oct 11, 2019
  2. DanielEdrisian commented on Oct 30, 2020

    @DanielEdrisian
    Contributor

    @xster this seems legit. Should we drop the assert?

  3. xster commented on Oct 31, 2020

    @xster
    Member

    Ya plausibly. Is it possible to have 1 tab item in Xcode?

  4. DanielEdrisian commented on Oct 31, 2020

    @DanielEdrisian
    Contributor

    Yes it is

  5. xster commented on Nov 2, 2020

    @xster
    Member

    Sure, removing that assert sounds reasonable to me.

  6. thennothinghappened commented on Aug 6, 2023

    @thennothinghappened

    Any update on this?

  7. flutter-triage-bot commented on Feb 12, 2024

    @flutter-triage-bot

    This issue is missing a priority label. Please set a priority label when adding the triaged-design label.

  8. added
    P3Issues that are less important to the Flutter project
    triaged-designTriaged by Design Languages team
    on Feb 14, 2024
  9. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 18, 2026
  10. github-actions commented on Sep 8, 2026

    @github-actions

    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.

  11. locked as resolved and limited conversation to collaborators on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: error messageError messages from the Flutter frameworkc: proposalA detailed proposal for a change to Flutterp: cupertino_uicupertino_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions