2022-03-11 00:09:03 +02:00
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
class MapboxInfo {
|
|
|
|
final bool isEnable;
|
|
|
|
final String mapboxSecret;
|
|
|
|
MapboxInfo({
|
|
|
|
required this.isEnable,
|
|
|
|
required this.mapboxSecret,
|
|
|
|
});
|
|
|
|
|
|
|
|
MapboxInfo copyWith({
|
|
|
|
bool? isEnable,
|
|
|
|
String? mapboxSecret,
|
|
|
|
}) {
|
|
|
|
return MapboxInfo(
|
|
|
|
isEnable: isEnable ?? this.isEnable,
|
|
|
|
mapboxSecret: mapboxSecret ?? this.mapboxSecret,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, dynamic> toMap() {
|
|
|
|
return {
|
|
|
|
'isEnable': isEnable,
|
|
|
|
'mapboxSecret': mapboxSecret,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
factory MapboxInfo.fromMap(Map<String, dynamic> map) {
|
|
|
|
return MapboxInfo(
|
|
|
|
isEnable: map['isEnable'] ?? false,
|
|
|
|
mapboxSecret: map['mapboxSecret'] ?? '',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
String toJson() => json.encode(toMap());
|
|
|
|
|
2022-06-25 22:12:47 +02:00
|
|
|
factory MapboxInfo.fromJson(String source) =>
|
|
|
|
MapboxInfo.fromMap(json.decode(source));
|
2022-03-11 00:09:03 +02:00
|
|
|
|
|
|
|
@override
|
2022-06-25 22:12:47 +02:00
|
|
|
String toString() =>
|
|
|
|
'MapboxInfo(isEnable: $isEnable, mapboxSecret: $mapboxSecret)';
|
2022-03-11 00:09:03 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
bool operator ==(Object other) {
|
|
|
|
if (identical(this, other)) return true;
|
|
|
|
|
2022-06-25 22:12:47 +02:00
|
|
|
return other is MapboxInfo &&
|
|
|
|
other.isEnable == isEnable &&
|
|
|
|
other.mapboxSecret == mapboxSecret;
|
2022-03-11 00:09:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode => isEnable.hashCode ^ mapboxSecret.hashCode;
|
|
|
|
}
|