mirror of
https://github.com/immich-app/immich.git
synced 2026-05-28 02:22:34 -04:00
55 lines
1.9 KiB
Dart
55 lines
1.9 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
|
|
class NetworkConfig {
|
|
final bool autoEndpointSwitching;
|
|
final String? preferredWifiName;
|
|
final String? localEndpoint;
|
|
final List<String> externalEndpointList;
|
|
final Map<String, String> customHeaders;
|
|
|
|
const NetworkConfig({
|
|
this.autoEndpointSwitching = false,
|
|
this.preferredWifiName,
|
|
this.localEndpoint,
|
|
this.externalEndpointList = const [],
|
|
this.customHeaders = const {},
|
|
});
|
|
|
|
NetworkConfig copyWith({
|
|
bool? autoEndpointSwitching,
|
|
String? preferredWifiName,
|
|
String? localEndpoint,
|
|
List<String>? externalEndpointList,
|
|
Map<String, String>? customHeaders,
|
|
}) => NetworkConfig(
|
|
autoEndpointSwitching: autoEndpointSwitching ?? this.autoEndpointSwitching,
|
|
preferredWifiName: preferredWifiName ?? this.preferredWifiName,
|
|
localEndpoint: localEndpoint ?? this.localEndpoint,
|
|
externalEndpointList: externalEndpointList ?? this.externalEndpointList,
|
|
customHeaders: customHeaders ?? this.customHeaders,
|
|
);
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is NetworkConfig &&
|
|
other.autoEndpointSwitching == autoEndpointSwitching &&
|
|
other.preferredWifiName == preferredWifiName &&
|
|
other.localEndpoint == localEndpoint &&
|
|
listEquals(other.externalEndpointList, externalEndpointList) &&
|
|
mapEquals(other.customHeaders, customHeaders));
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
autoEndpointSwitching,
|
|
preferredWifiName,
|
|
localEndpoint,
|
|
Object.hashAll(externalEndpointList),
|
|
Object.hashAllUnordered(customHeaders.entries.map((e) => Object.hash(e.key, e.value))),
|
|
);
|
|
|
|
@override
|
|
String toString() =>
|
|
'NetworkConfig(autoEndpointSwitching: $autoEndpointSwitching, preferredWifiName: $preferredWifiName, localEndpoint: $localEndpoint, externalEndpointList: $externalEndpointList, customHeaders: $customHeaders)';
|
|
}
|