Migrated to Dart 3
This commit is contained in:
parent
0010405bda
commit
5ad3ab195d
6 changed files with 20 additions and 18 deletions
|
@ -1,5 +1,9 @@
|
||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## 7.0.0-beta.1
|
||||||
|
|
||||||
|
* Require Dart >= 3.0
|
||||||
|
|
||||||
## 6.0.1
|
## 6.0.1
|
||||||
|
|
||||||
* Updated README
|
* Updated README
|
||||||
|
|
|
@ -12,7 +12,7 @@ The ***new and improved*** definitive solution for JSON in Dart. It supports syn
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
belatuk_json_serializer: ^6.0.0
|
belatuk_json_serializer: ^7.0.0
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
name: belatuk_json_serializer
|
name: belatuk_json_serializer
|
||||||
version: 6.0.1
|
version: 7.0.0-beta.1
|
||||||
description: Easy JSON to Object serialization and deserialization in Dart.
|
description: Easy JSON to Object serialization and deserialization in Dart.
|
||||||
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/json_serializer
|
homepage: https://github.com/dart-backend/belatuk-common-utilities/tree/main/packages/json_serializer
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.17.0 <3.0.0'
|
sdk: '>=3.0.0-290.3.beta <4.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
logging: ^1.0.1
|
logging: ^1.0.1
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
stack_trace: ^1.10.0
|
stack_trace: ^1.10.0
|
||||||
test: ^1.17.4
|
test: ^1.24.0
|
||||||
lints: ^2.0.0
|
lints: ^2.0.0
|
|
@ -105,11 +105,11 @@ testDeserializationWithSchemaValidation() async {
|
||||||
god.deserialize(babelRcJson, outputType: BabelRc) as BabelRc;
|
god.deserialize(babelRcJson, outputType: BabelRc) as BabelRc;
|
||||||
|
|
||||||
print(deserialized.presets.runtimeType);
|
print(deserialized.presets.runtimeType);
|
||||||
expect(deserialized.presets is List, equals(true));
|
//expect(deserialized.presets is List, equals(true));
|
||||||
expect(deserialized.presets.length, equals(2));
|
expect(deserialized.presets.length, equals(2));
|
||||||
expect(deserialized.presets[0], equals('es2015'));
|
expect(deserialized.presets[0], equals('es2015'));
|
||||||
expect(deserialized.presets[1], equals('stage-0'));
|
expect(deserialized.presets[1], equals('stage-0'));
|
||||||
expect(deserialized.plugins is List, equals(true));
|
//expect(deserialized.plugins is List, equals(true));
|
||||||
expect(deserialized.plugins.length, equals(1));
|
expect(deserialized.plugins.length, equals(1));
|
||||||
expect(deserialized.plugins[0], equals('add-module-exports'));
|
expect(deserialized.plugins[0], equals('add-module-exports'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,14 +11,14 @@ void printRecord(LogRecord rec) {
|
||||||
class SampleNestedClass {
|
class SampleNestedClass {
|
||||||
String? bar;
|
String? bar;
|
||||||
|
|
||||||
SampleNestedClass([String? this.bar]);
|
SampleNestedClass([this.bar]);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SampleClass {
|
class SampleClass {
|
||||||
String? hello;
|
String? hello;
|
||||||
List<SampleNestedClass> nested = [];
|
List<SampleNestedClass> nested = [];
|
||||||
|
|
||||||
SampleClass([String? this.hello]);
|
SampleClass([this.hello]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithSchemaUrl(
|
@WithSchemaUrl(
|
||||||
|
@ -27,25 +27,23 @@ class BabelRc {
|
||||||
List<String> presets;
|
List<String> presets;
|
||||||
List<String> plugins;
|
List<String> plugins;
|
||||||
|
|
||||||
BabelRc(
|
BabelRc({this.presets = const [], this.plugins = const []});
|
||||||
{List<String> this.presets: const [],
|
|
||||||
List<String> this.plugins: const []});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithSchema(const {
|
@WithSchema({
|
||||||
r"$schema": "http://json-schema.org/draft-04/schema#",
|
r"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "Validated Sample Class",
|
"title": "Validated Sample Class",
|
||||||
"description": "Sample schema for validation via JSON God",
|
"description": "Sample schema for validation via JSON God",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"hello": const {"description": "A friendly greeting.", "type": "string"},
|
"hello": {"description": "A friendly greeting.", "type": "string"},
|
||||||
"nested": const {
|
"nested": {
|
||||||
"description": "A list of NestedSampleClass items within this instance.",
|
"description": "A list of NestedSampleClass items within this instance.",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": const {
|
"items": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"bar": const {"description": "Filler text", "type": "string"}
|
"bar": {"description": "Filler text", "type": "string"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": const ["hello", "nested"]
|
"required": ["hello", "nested"]
|
||||||
})
|
})
|
||||||
class ValidatedSampleClass {}
|
class ValidatedSampleClass {}
|
||||||
|
|
|
@ -8,7 +8,7 @@ main() {
|
||||||
test('fromJson', () {
|
test('fromJson', () {
|
||||||
var foo = god.deserialize('{"bar":"baz"}', outputType: Foo) as Foo;
|
var foo = god.deserialize('{"bar":"baz"}', outputType: Foo) as Foo;
|
||||||
|
|
||||||
expect(foo is Foo, true);
|
//expect(foo is Foo, true);
|
||||||
expect(foo.text, equals('baz'));
|
expect(foo.text, equals('baz'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue