📅  最后修改于: 2022-03-11 14:49:21.539000             🧑  作者: Mango
var keyA = UniqueKey();
var keyB = UniqueKey();
var keyC = UniqueKey();
var keyD = UniqueKey();
List widgetList = List();
widgetList.add(WidgetA(key: keyA));
widgetList.add(WidgetB(key: keyB));
widgetList.add(WidgetC(key: keyC));
widgetList.add(WidgetD(key: keyD));
Widget activeWidget = widgetList.firstWhere((x) => x.key == keyB);