Skip to content

Commit ec4327f

Browse files
committed
Avoid using freezed
I'm just trying to reduce the amount of external dependencies for now.
1 parent 502f4fb commit ec4327f

File tree

3 files changed

+47
-285
lines changed

3 files changed

+47
-285
lines changed

lib/git_url_parse.dart

+47-14
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,52 @@
11
library git_url_parse;
22

3-
import 'package:freezed_annotation/freezed_annotation.dart';
4-
5-
part 'git_url_parse.freezed.dart';
6-
7-
@freezed
8-
class GitUrlParseResult with _$GitUrlParseResult {
9-
factory GitUrlParseResult({
10-
required int port,
11-
required String resource,
12-
required String user,
13-
required String path,
14-
required String protocol,
15-
required String token,
16-
}) = _GitUrlParseResult;
3+
import 'package:meta/meta.dart';
4+
5+
@immutable
6+
class GitUrlParseResult {
7+
final int port;
8+
final String resource;
9+
final String user;
10+
final String path;
11+
final String protocol;
12+
final String token;
13+
14+
GitUrlParseResult({
15+
required this.port,
16+
required this.resource,
17+
required this.user,
18+
required this.path,
19+
required this.protocol,
20+
required this.token,
21+
});
22+
23+
@override
24+
String toString() {
25+
return 'GitUrlParseResult(port: $port, resource: $resource, user: $user, path: $path, protocol: $protocol, token: $token)';
26+
}
27+
28+
@override
29+
bool operator ==(Object other) {
30+
if (identical(this, other)) return true;
31+
32+
return other is GitUrlParseResult &&
33+
other.port == port &&
34+
other.resource == resource &&
35+
other.user == user &&
36+
other.path == path &&
37+
other.protocol == protocol &&
38+
other.token == token;
39+
}
40+
41+
@override
42+
int get hashCode {
43+
return port.hashCode ^
44+
resource.hashCode ^
45+
user.hashCode ^
46+
path.hashCode ^
47+
protocol.hashCode ^
48+
token.hashCode;
49+
}
1750
}
1851

1952
GitUrlParseResult? gitUrlParse(String url) {

lib/git_url_parse.freezed.dart

-269
This file was deleted.

pubspec.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ dependencies:
1717
equatable: ^2.0.5
1818
fast_immutable_collections: ^9.1.5
1919
file: ^6.1.4
20-
freezed_annotation: ^2.2.0
2120
meta: ^1.8.0
2221
path: ^1.8.2
2322
synchronized: ^3.0.1
@@ -26,7 +25,6 @@ dependencies:
2625
dev_dependencies:
2726
archive: ^3.3.5
2827
build_runner:
29-
freezed: ^2.3.2
3028
import_sorter: ^4.6.0
3129
lints: ^3.0.0
3230
process_run: ^0.12.5+2

0 commit comments

Comments
 (0)