plugin_framework, fix dup ui widgets

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-04-29 12:34:27 +08:00
parent 2e12d66615
commit c315924ef7
2 changed files with 10 additions and 3 deletions

View File

@@ -23,7 +23,16 @@ class PluginModel with ChangeNotifier {
final Map<String, String> opts = {};
void add(UiType ui) {
uiList.add(ui);
bool found = false;
for (int i = 0; i < uiList.length; i++) {
if (uiList[i].key == ui.key) {
uiList[i] = ui;
found = true;
}
}
if (!found) {
uiList.add(ui);
}
notifyListeners();
}