Added an empty list example to the ListView docs (#56394)
Added and example to the ListView docs that shows how to have a custom UI for an empty list.
diff --git a/packages/flutter/lib/src/widgets/scroll_view.dart b/packages/flutter/lib/src/widgets/scroll_view.dart
index 51882cd..3ee7609 100644
--- a/packages/flutter/lib/src/widgets/scroll_view.dart
+++ b/packages/flutter/lib/src/widgets/scroll_view.dart
@@ -21,6 +21,9 @@
import 'sliver.dart';
import 'viewport.dart';
+// Examples can assume:
+// int itemCount;
+
/// A representation of how a [ScrollView] should dismiss the on-screen
/// keyboard.
enum ScrollViewKeyboardDismissBehavior {
@@ -865,6 +868,36 @@
/// ```
/// {@end-tool}
///
+/// ## Special handling for an empty list
+///
+/// A common design pattern is to have a custom UI for an empty list. The best
+/// way to achieve this in Flutter is just conditionally replacing the
+/// [ListView] at build time with whatever widgets you need to show for the
+/// empty list state:
+///
+/// {@tool snippet}
+///
+/// Example of simple empty list interface:
+///
+/// ```dart
+/// Widget build(BuildContext context) {
+/// return Scaffold(
+/// appBar: AppBar(title: const Text('Empty List Test')),
+/// body: itemCount > 0
+/// ? ListView.builder(
+/// itemCount: itemCount,
+/// itemBuilder: (BuildContext context, int index) {
+/// return ListTile(
+/// title: Text('Item ${index + 1}'),
+/// );
+/// },
+/// )
+/// : Center(child: const Text('No items')),
+/// );
+/// }
+/// ```
+/// {@end-tool}
+///
/// See also:
///
/// * [SingleChildScrollView], which is a scrollable widget that has a single