📜  flutter 查找小部件 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:21.539000             🧑  作者: Mango

代码示例1
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);