relatica/lib/models/instance_info.dart

69 wiersze
1.7 KiB
Dart

import 'package:flutter/foundation.dart';
import 'friendica_version.dart';
class InstanceInfo {
final int maxStatusCharacters;
final FriendicaVersion friendicaVersion;
final String versionString;
final int maxImageBytes;
const InstanceInfo({
required this.maxStatusCharacters,
required this.friendicaVersion,
required this.versionString,
required this.maxImageBytes,
});
@override
String toString() {
return 'InstanceInfo{maxStatusCharacters: $maxStatusCharacters, version: $versionString, maxImageBytes: $maxImageBytes}';
}
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is InstanceInfo &&
runtimeType == other.runtimeType &&
maxStatusCharacters == other.maxStatusCharacters &&
friendicaVersion == other.friendicaVersion &&
versionString == other.versionString &&
maxImageBytes == other.maxImageBytes;
@override
int get hashCode =>
maxStatusCharacters.hashCode ^
friendicaVersion.hashCode ^
versionString.hashCode ^
maxImageBytes.hashCode;
}
class InstanceRules {
final Map<String, String> rules;
const InstanceRules({this.rules = const {}});
@override
String toString() {
return 'InstanceRules{rules: $rules}';
}
String toListString() {
if (rules.isEmpty) {
return '';
}
return rules.entries.map((e) => '${e.key}: ${e.value}').join('\n');
}
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is InstanceRules &&
runtimeType == other.runtimeType &&
mapEquals(rules, other.rules);
@override
int get hashCode => Object.hashAll(rules.values);
}