38 lines
850 B
Dart
38 lines
850 B
Dart
|
|
class SavedConnection {
|
||
|
|
final String id;
|
||
|
|
final String host;
|
||
|
|
final int port;
|
||
|
|
final String username;
|
||
|
|
final String? privateKey; // Stores the content of the private key file
|
||
|
|
|
||
|
|
SavedConnection({
|
||
|
|
required this.id,
|
||
|
|
required this.host,
|
||
|
|
required this.port,
|
||
|
|
required this.username,
|
||
|
|
this.privateKey,
|
||
|
|
});
|
||
|
|
|
||
|
|
String get label => '$username@$host:$port';
|
||
|
|
|
||
|
|
Map<String, dynamic> toJson() {
|
||
|
|
return {
|
||
|
|
'id': id,
|
||
|
|
'host': host,
|
||
|
|
'port': port,
|
||
|
|
'username': username,
|
||
|
|
'privateKey': privateKey,
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
factory SavedConnection.fromJson(Map<String, dynamic> json) {
|
||
|
|
return SavedConnection(
|
||
|
|
id: json['id'] as String,
|
||
|
|
host: json['host'] as String,
|
||
|
|
port: json['port'] as int,
|
||
|
|
username: json['username'] as String,
|
||
|
|
privateKey: json['privateKey'] as String?,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|