Line data Source code
1 : import 'package:json_annotation/json_annotation.dart';
2 :
3 : part 'open_port.g.dart';
4 :
5 : /// Represents open port for a target Address
6 : @JsonSerializable()
7 : class OpenPort {
8 1 : OpenPort(this.port, {this.isOpen = true});
9 1 : factory OpenPort.fromJson(Map<String, dynamic> json) =>
10 1 : _$OpenPortFromJson(json);
11 :
12 : final int port;
13 : final bool isOpen;
14 :
15 1 : int compareTo(OpenPort other) {
16 3 : return port.compareTo(other.port);
17 : }
18 :
19 1 : @override
20 2 : int get hashCode => port.hashCode;
21 :
22 1 : @override
23 : bool operator ==(Object other) {
24 : if (identical(this, other)) return true;
25 4 : return other is OpenPort && other.port == port;
26 : }
27 :
28 1 : @override
29 : String toString() {
30 2 : return port.toString();
31 : }
32 :
33 2 : Map<String, dynamic> toJson() => _$OpenPortToJson(this);
34 : }
|