server_config.model.dart 943 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import 'package:openapi/api.dart';
  2. class ServerConfig {
  3. final int trashDays;
  4. final String mapTileUrl;
  5. const ServerConfig({
  6. required this.trashDays,
  7. required this.mapTileUrl,
  8. });
  9. ServerConfig copyWith({
  10. int? trashDays,
  11. String? mapTileUrl,
  12. }) {
  13. return ServerConfig(
  14. trashDays: trashDays ?? this.trashDays,
  15. mapTileUrl: mapTileUrl ?? this.mapTileUrl,
  16. );
  17. }
  18. @override
  19. String toString() {
  20. return 'ServerConfig(trashDays: $trashDays, mapTileUrl: $mapTileUrl)';
  21. }
  22. ServerConfig.fromDto(ServerConfigDto dto)
  23. : trashDays = dto.trashDays,
  24. mapTileUrl = dto.mapTileUrl;
  25. @override
  26. bool operator ==(Object other) {
  27. if (identical(this, other)) return true;
  28. return other is ServerConfig &&
  29. other.trashDays == trashDays &&
  30. other.mapTileUrl == mapTileUrl;
  31. }
  32. @override
  33. int get hashCode {
  34. return trashDays.hashCode ^ mapTileUrl.hashCode;
  35. }
  36. }