You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
725 B

import 'package:json_annotation/json_annotation.dart';
part 'connection_status.g.dart';
@JsonSerializable()
class ConnectionStatus {
ConnectionStatus(
this.message,
this.errorCode,
this.errorDetails, {
required this.connected,
});
@JsonKey(name: 'connected')
final bool connected;
@JsonKey(name: 'message')
final String? message;
@JsonKey(name: 'errorCode')
final String? errorCode;
@JsonKey(name: 'errorDetails')
final String? errorDetails;
bool hasError() {
return errorCode?.isNotEmpty == true;
}
factory ConnectionStatus.fromJson(Map<String, dynamic> json) =>
_$ConnectionStatusFromJson(json);
Map<String, dynamic> toJson() => _$ConnectionStatusToJson(this);
}