From 871f34fca3ab708947b8d85967e48c1d5eda25e3 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Mon, 1 Mar 2021 13:30:51 +0800 Subject: [PATCH] fix sepWidget extension when list empty --- lib/extension/list_extension.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/extension/list_extension.dart b/lib/extension/list_extension.dart index 4756bf3..f0dc735 100644 --- a/lib/extension/list_extension.dart +++ b/lib/extension/list_extension.dart @@ -3,6 +3,8 @@ import 'package:ansu_ui/extension/num_extension.dart'; extension SeparateExt on List { List sepWidget({Widget separate}) { + if (this == null) return null; + if (this.isEmpty) return []; return List.generate(this.length * 2 - 1, (index) { if (index.isEven) return this[index ~/ 2];