Skip to content

Commit

Permalink
add dart project to repo and add equatable options
Browse files Browse the repository at this point in the history
  • Loading branch information
chunlee-aba committed Aug 4, 2022
1 parent f623ec3 commit f40f5cd
Show file tree
Hide file tree
Showing 13 changed files with 695 additions and 311 deletions.
6 changes: 6 additions & 0 deletions dart-result/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Files and directories created by pub.
.dart_tool/
.packages

# Conventional directory for build output.
build/
3 changes: 3 additions & 0 deletions dart-result/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.0.0

- Initial version.
2 changes: 2 additions & 0 deletions dart-result/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
A sample command-line application with an entrypoint in `bin/`, library code
in `lib/`, and example unit test in `test/`.
30 changes: 30 additions & 0 deletions dart-result/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.

include: package:lints/recommended.yaml

# Uncomment the following section to specify additional rules.

# linter:
# rules:
# - camel_case_types

# analyzer:
# exclude:
# - path/to/excluded/files/**

# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints

# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options
1 change: 1 addition & 0 deletions dart-result/lib/dart_result.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:json_annotation/json_annotation.dart';

part 'filename.g.dart';

@JsonSerializable(createToJson: false)
@JsonSerializable()
class MyClass {
MyClass({
required this.valInt,
Expand Down Expand Up @@ -61,14 +61,19 @@ class MyClass {

factory MyClass.fromJson(Map<String, dynamic> json) => _$MyClassFromJson(json);

Map<String, dynamic> toJson() => _$MyClassToJson(this);

@override
String toString(){
return '$valInt, $valBool, $valDate, $valString, $valNull, $valDouble, $valArrInt, $valueArrEmpty, $valueObjEmpty, $valArrString, $valObj, $valObjInObj, $valArrObj';
}

@override
List<Object?> get props => [
valInt, valBool, valDate, valString, valNull, valDouble, valArrInt, valueArrEmpty, valueObjEmpty, valArrString, valObj, valObjInObj, valArrObj, ];
}

@JsonSerializable(createToJson: false)
@JsonSerializable()
class ValArrObj {
ValArrObj({
required this.dog,
Expand All @@ -84,14 +89,19 @@ class ValArrObj {

factory ValArrObj.fromJson(Map<String, dynamic> json) => _$ValArrObjFromJson(json);

Map<String, dynamic> toJson() => _$ValArrObjToJson(this);

@override
String toString(){
return '$dog, $cat, $hehe, $test';
}

@override
List<Object?> get props => [
dog, cat, hehe, test, ];
}

@JsonSerializable(createToJson: false)
@JsonSerializable()
class ValObj {
ValObj({
required this.street,
Expand All @@ -103,14 +113,19 @@ class ValObj {

factory ValObj.fromJson(Map<String, dynamic> json) => _$ValObjFromJson(json);

Map<String, dynamic> toJson() => _$ValObjToJson(this);

@override
String toString(){
return '$street, $city';
}

@override
List<Object?> get props => [
street, city, ];
}

@JsonSerializable(createToJson: false)
@JsonSerializable()
class ValObjInObj {
ValObjInObj({
required this.street,
Expand All @@ -124,14 +139,19 @@ class ValObjInObj {

factory ValObjInObj.fromJson(Map<String, dynamic> json) => _$ValObjInObjFromJson(json);

Map<String, dynamic> toJson() => _$ValObjInObjToJson(this);

@override
String toString(){
return '$street, $city, $province';
}

@override
List<Object?> get props => [
street, city, province, ];
}

@JsonSerializable(createToJson: false)
@JsonSerializable()
class Province {
Province({
required this.country,
Expand All @@ -145,22 +165,32 @@ class Province {

factory Province.fromJson(Map<String, dynamic> json) => _$ProvinceFromJson(json);

Map<String, dynamic> toJson() => _$ProvinceToJson(this);

@override
String toString(){
return '$country, $population, $something';
}

@override
List<Object?> get props => [
country, population, something, ];
}

@JsonSerializable(createToJson: false)
@JsonSerializable()
class ValueObjEmpty {
ValueObjEmpty();

factory ValueObjEmpty.fromJson(Map<String, dynamic> json) => _$ValueObjEmptyFromJson(json);

Map<String, dynamic> toJson() => _$ValueObjEmptyToJson(this);

@override
String toString(){
return '';
}

@override
List<Object?> get props => [
];
}
Loading

0 comments on commit f40f5cd

Please sign in to comment.