FLUTTER ECOSYSTEM

nil

A simple widget to add in the widget tree when you want to show nothing, with minimal impact on performance.

Latest version
1.1.1
30-day downloads
7.1K
Likes
324
Pub points
140

Package Overview

Selection guidance generated from public package information. For reference only.

Overview

The nil package provides a minimal, performance-optimized widget that renders nothing when included in the widget tree. It's designed for scenarios where you need a placeholder or conditional widget that doesn't contribute to layout or rendering overhead. Unlike SizedBox.shrink() or Container(), nil has zero impact on the widget tree’s performance and is ideal for dynamic UI logic where visibility conditions are handled externally. It's lightweight and safe to use in complex or frequently updated UIs.

Use cases
  • Conditional rendering with no visual output
  • Replacing empty containers in dynamic layouts
  • Optimizing performance in large widget trees
  • Simplifying null checks in widget composition
  • Avoiding unnecessary layout calculations
Key features
  • Zero rendering cost
  • No layout impact
  • Minimal memory footprint
  • Simple API
  • Safe for frequent updates
Suitable for
  • Developers optimizing UI performance
  • Builders of dynamic or conditional UIs
  • Teams prioritizing minimal overhead
  • Apps with complex or nested widget trees
  • Those seeking a clean alternative to empty widgets
Considerations
  • Not suitable for visible content
  • Does not support child widgets
  • Only useful when intentionally rendering nothing
  • Not needed if using built-in null-safe constructs
  • Best used in conjunction with conditional logic
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add nil

Categories

Source repository

Related projects