From 45c3d7061529fc173164ff69aa27a48c05283883 Mon Sep 17 00:00:00 2001 From: knightforce Date: Thu, 19 Dec 2024 15:17:20 +0500 Subject: [PATCH] defaultConnectionId == defaultNetwork.id --- .../connection_network/connection_network.dart | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/app/service/connection/data/connection_network/connection_network.dart b/lib/app/service/connection/data/connection_network/connection_network.dart index 4e44559c..1a1aeb27 100644 --- a/lib/app/service/connection/data/connection_network/connection_network.dart +++ b/lib/app/service/connection/data/connection_network/connection_network.dart @@ -5,19 +5,20 @@ import 'package:collection/collection.dart'; class ConnectionNetwork { ConnectionNetwork({ - required this.defaultConnectionId, + required String defaultConnectionId, List? networks, Map? transports, }) : networks = networks ?? [], - transports = transports ?? {}; + transports = transports ?? {}, + defaultNetwork = networks?.firstWhereOrNull( + (n) => n.id == defaultConnectionId, + ) ?? + networks?.firstOrNull ?? + defaultPresetNetwork; - final String defaultConnectionId; final List networks; final Map transports; - late final ConnectionData defaultNetwork = networks.firstWhereOrNull( - (n) => n.id == defaultConnectionId, - ) ?? - networks.firstOrNull ?? - defaultPresetNetwork; + late final ConnectionData defaultNetwork; + late final String defaultConnectionId = defaultNetwork.id; }