mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: spi with same id (#585)
This commit is contained in:
@@ -13,6 +13,7 @@ import 'package:server_box/data/provider/server.dart';
|
||||
import 'package:server_box/core/route.dart';
|
||||
import 'package:server_box/data/model/server/server_private_info.dart';
|
||||
import 'package:server_box/data/provider/private_key.dart';
|
||||
import 'package:server_box/data/store/server.dart';
|
||||
|
||||
class ServerEditPage extends StatefulWidget {
|
||||
final Spi? args;
|
||||
@@ -609,6 +610,12 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
envs: _env.value.isEmpty ? null : _env.value,
|
||||
);
|
||||
|
||||
final existsIds = ServerStore.instance.box.keys;
|
||||
if (existsIds.contains(spi.id)) {
|
||||
context.showSnackBar('${l10n.sameIdServerExist}: ${spi.id}');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.spi == null) {
|
||||
ServerProvider.addServer(spi);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user