-
Notifications
You must be signed in to change notification settings - Fork 387
/
input.type_uri.dart
45 lines (32 loc) · 1.07 KB
/
input.type_uri.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:json_annotation/json_annotation.dart';
part 'input.type_uri.g.dart';
@JsonSerializable()
class SimpleClass {
final Uri value;
@JsonKey(defaultValue: _defaultValueFunc)
Uri withDefault;
SimpleClass(
this.value,
this.withDefault,
);
factory SimpleClass.fromJson(Map<String, Object?> json) =>
_$SimpleClassFromJson(json);
Map<String, Object?> toJson() => _$SimpleClassToJson(this);
}
@JsonSerializable()
class SimpleClassNullable {
final Uri? value;
@JsonKey(defaultValue: _defaultValueFunc)
Uri? withDefault;
SimpleClassNullable(
this.value,
this.withDefault,
);
factory SimpleClassNullable.fromJson(Map<String, Object?> json) =>
_$SimpleClassNullableFromJson(json);
Map<String, Object?> toJson() => _$SimpleClassNullableToJson(this);
}
Uri _defaultValueFunc() => Uri.parse('https://example.com');