From 26d239049bb712e3831f79d7b5d40a4f2d35b7a7 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Fri, 5 Feb 2016 20:42:22 -0800 Subject: [PATCH] Overlay polish Fixes #1607 --- packages/flutter/lib/src/widgets/overlay.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/flutter/lib/src/widgets/overlay.dart b/packages/flutter/lib/src/widgets/overlay.dart index d2199e1b35..9225413412 100644 --- a/packages/flutter/lib/src/widgets/overlay.dart +++ b/packages/flutter/lib/src/widgets/overlay.dart @@ -62,8 +62,10 @@ class _OverlayEntryState extends State<_OverlayEntry> { class Overlay extends StatefulComponent { Overlay({ Key key, - this.initialEntries - }) : super(key: key); + this.initialEntries: const [] + }) : super(key: key) { + assert(initialEntries != null); + } /// The entries to include in the overlay initially. final List initialEntries; @@ -103,6 +105,8 @@ class OverlayState extends State { /// Otherwise, the entries are inserted on top. void insertAll(Iterable entries, { OverlayEntry above }) { assert(above == null || (above._overlay == this && _entries.contains(above))); + if (entries.isEmpty) + return; for (OverlayEntry entry in entries) { assert(entry._overlay == null); entry._overlay = this;