-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
2,981 additions
and
9 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:learning_about_b4a_flutter/app/core/models/genre_model.dart'; | ||
|
||
class AuthorModel { | ||
final String? objectId; | ||
final String? typeString; | ||
final bool? typeBoolean; | ||
final num? typeNumber; | ||
final DateTime? typeDateTime; | ||
final List<String>? typeArray; | ||
final GenreModel? typePointerGenre; | ||
AuthorModel({ | ||
this.objectId, | ||
this.typeString, | ||
this.typeBoolean, | ||
this.typeNumber, | ||
this.typeDateTime, | ||
this.typeArray, | ||
this.typePointerGenre, | ||
}); | ||
|
||
AuthorModel copyWith({ | ||
String? objectId, | ||
String? typeString, | ||
bool? typeBoolean, | ||
num? typeNumber, | ||
DateTime? typeDate, | ||
Map<String, dynamic>? typeObject, | ||
List<String>? typeArray, | ||
GenreModel? typePointer, | ||
}) { | ||
return AuthorModel( | ||
objectId: objectId ?? this.objectId, | ||
typeString: typeString ?? this.typeString, | ||
typeBoolean: typeBoolean ?? this.typeBoolean, | ||
typeNumber: typeNumber ?? this.typeNumber, | ||
typeDateTime: typeDate ?? typeDateTime, | ||
typeArray: typeArray ?? this.typeArray, | ||
typePointerGenre: typePointer ?? typePointerGenre, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toMap() { | ||
final result = <String, dynamic>{}; | ||
|
||
if (objectId != null) { | ||
result.addAll({'objectId': objectId}); | ||
} | ||
if (typeString != null) { | ||
result.addAll({'typeString': typeString}); | ||
} | ||
if (typeBoolean != null) { | ||
result.addAll({'typeBoolean': typeBoolean}); | ||
} | ||
if (typeNumber != null) { | ||
result.addAll({'typeNumber': typeNumber}); | ||
} | ||
if (typeDateTime != null) { | ||
result.addAll({'typeDate': typeDateTime!.millisecondsSinceEpoch}); | ||
} | ||
|
||
if (typeArray != null) { | ||
result.addAll({'typeArray': typeArray}); | ||
} | ||
|
||
if (typePointerGenre != null) { | ||
result.addAll({'typePointer': typePointerGenre!.toMap()}); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
factory AuthorModel.fromMap(Map<String, dynamic> map) { | ||
return AuthorModel( | ||
objectId: map['objectId'], | ||
typeString: map['typeString'], | ||
typeBoolean: map['typeBoolean'], | ||
typeNumber: map['typeNumber'], | ||
typeDateTime: map['typeDate'] != null | ||
? DateTime.fromMillisecondsSinceEpoch(map['typeDate']) | ||
: null, | ||
typeArray: List<String>.from(map['typeArray']), | ||
typePointerGenre: map['typePointer'] != null | ||
? GenreModel.fromMap(map['typePointer']) | ||
: null, | ||
); | ||
} | ||
|
||
String toJson() => json.encode(toMap()); | ||
|
||
factory AuthorModel.fromJson(String source) => | ||
AuthorModel.fromMap(json.decode(source)); | ||
|
||
@override | ||
String toString() { | ||
return 'AuthorModel(objectId: $objectId, typeString: $typeString, typeBoolean: $typeBoolean, typeNumber: $typeNumber, typeDate: $typeDateTime, typeArray: $typeArray, typePointer: $typePointerGenre)'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:learning_about_b4a_flutter/app/core/models/author_model.dart'; | ||
import 'package:learning_about_b4a_flutter/app/core/models/publisher_model.dart'; | ||
|
||
class BookModel { | ||
final String? objectId; | ||
final String? typeString; | ||
final bool? typeBoolean; | ||
final num? typeNumber; | ||
final DateTime? typeDateTime; | ||
final List<String>? typeArray; | ||
final PublisherModel? typePointerPublisher; | ||
final List<AuthorModel>? typeRelationAuthor; | ||
BookModel({ | ||
this.objectId, | ||
this.typeString, | ||
this.typeBoolean, | ||
this.typeNumber, | ||
this.typeDateTime, | ||
this.typeArray, | ||
this.typePointerPublisher, | ||
this.typeRelationAuthor, | ||
}); | ||
BookModel copyWith({ | ||
String? objectId, | ||
String? typeString, | ||
bool? typeBoolean, | ||
num? typeNumber, | ||
DateTime? typeDate, | ||
Map<String, dynamic>? typeObject, | ||
List<String>? typeArray, | ||
String? typeFile, | ||
PublisherModel? typePointer, | ||
List<AuthorModel>? typeRelation, | ||
}) { | ||
return BookModel( | ||
objectId: objectId ?? this.objectId, | ||
typeString: typeString ?? this.typeString, | ||
typeBoolean: typeBoolean ?? this.typeBoolean, | ||
typeNumber: typeNumber ?? this.typeNumber, | ||
typeDateTime: typeDate ?? typeDateTime, | ||
typeArray: typeArray ?? this.typeArray, | ||
typePointerPublisher: typePointer ?? typePointerPublisher, | ||
typeRelationAuthor: typeRelation ?? typeRelationAuthor, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toMap() { | ||
final result = <String, dynamic>{}; | ||
|
||
if (objectId != null) { | ||
result.addAll({'objectId': objectId}); | ||
} | ||
if (typeString != null) { | ||
result.addAll({'typeString': typeString}); | ||
} | ||
if (typeBoolean != null) { | ||
result.addAll({'typeBoolean': typeBoolean}); | ||
} | ||
if (typeNumber != null) { | ||
result.addAll({'typeNumber': typeNumber}); | ||
} | ||
if (typeDateTime != null) { | ||
result.addAll({'typeDate': typeDateTime!.millisecondsSinceEpoch}); | ||
} | ||
if (typeArray != null) { | ||
result.addAll({'typeArray': typeArray}); | ||
} | ||
if (typePointerPublisher != null) { | ||
result.addAll({'typePointer': typePointerPublisher!.toMap()}); | ||
} | ||
if (typeRelationAuthor != null) { | ||
result.addAll( | ||
{'typeRelation': typeRelationAuthor!.map((x) => x.toMap()).toList()}); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
factory BookModel.fromMap(Map<String, dynamic> map) { | ||
return BookModel( | ||
objectId: map['objectId'], | ||
typeString: map['typeString'], | ||
typeBoolean: map['typeBoolean'], | ||
typeNumber: map['typeNumber'], | ||
typeDateTime: map['typeDate'] != null | ||
? DateTime.fromMillisecondsSinceEpoch(map['typeDate']) | ||
: null, | ||
typeArray: List<String>.from(map['typeArray']), | ||
typePointerPublisher: map['typePointer'] != null | ||
? PublisherModel.fromMap(map['typePointer']) | ||
: null, | ||
typeRelationAuthor: map['typeRelation'] != null | ||
? List<AuthorModel>.from( | ||
map['typeRelation']?.map((x) => AuthorModel.fromMap(x))) | ||
: null, | ||
); | ||
} | ||
|
||
String toJson() => json.encode(toMap()); | ||
|
||
factory BookModel.fromJson(String source) => | ||
BookModel.fromMap(json.decode(source)); | ||
|
||
@override | ||
String toString() { | ||
return 'BookModel(objectId: $objectId, typeString: $typeString, typeBoolean: $typeBoolean, typeNumber: $typeNumber, typeDate: $typeDateTime, typeArray: $typeArray, typePointer: $typePointerPublisher, typeRelation: $typeRelationAuthor)'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import 'dart:convert'; | ||
|
||
class GenreModel { | ||
final String? objectId; | ||
final String? typeString; | ||
final bool? typeBoolean; | ||
final num? typeNumber; | ||
final DateTime? typeDateTime; | ||
final List<String>? typeArray; | ||
GenreModel({ | ||
this.objectId, | ||
this.typeString, | ||
this.typeBoolean, | ||
this.typeNumber, | ||
this.typeDateTime, | ||
this.typeArray, | ||
}); | ||
|
||
GenreModel copyWith({ | ||
String? objectId, | ||
String? typeString, | ||
bool? typeBoolean, | ||
num? typeNumber, | ||
DateTime? typeDate, | ||
Map<String, dynamic>? typeObject, | ||
List<String>? typeArray, | ||
}) { | ||
return GenreModel( | ||
objectId: objectId ?? this.objectId, | ||
typeString: typeString ?? this.typeString, | ||
typeBoolean: typeBoolean ?? this.typeBoolean, | ||
typeNumber: typeNumber ?? this.typeNumber, | ||
typeDateTime: typeDate ?? this.typeDateTime, | ||
typeArray: typeArray ?? this.typeArray, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toMap() { | ||
final result = <String, dynamic>{}; | ||
|
||
if (objectId != null) { | ||
result.addAll({'objectId': objectId}); | ||
} | ||
if (typeString != null) { | ||
result.addAll({'typeString': typeString}); | ||
} | ||
if (typeBoolean != null) { | ||
result.addAll({'typeBoolean': typeBoolean}); | ||
} | ||
if (typeNumber != null) { | ||
result.addAll({'typeNumber': typeNumber}); | ||
} | ||
if (typeDateTime != null) { | ||
result.addAll({'typeDate': typeDateTime!.millisecondsSinceEpoch}); | ||
} | ||
if (typeArray != null) { | ||
result.addAll({'typeArray': typeArray}); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
factory GenreModel.fromMap(Map<String, dynamic> map) { | ||
return GenreModel( | ||
objectId: map['objectId'], | ||
typeString: map['typeString'], | ||
typeBoolean: map['typeBoolean'], | ||
typeNumber: map['typeNumber'], | ||
typeDateTime: map['typeDate'] != null | ||
? DateTime.fromMillisecondsSinceEpoch(map['typeDate']) | ||
: null, | ||
typeArray: List<String>.from(map['typeArray']), | ||
); | ||
} | ||
|
||
String toJson() => json.encode(toMap()); | ||
|
||
factory GenreModel.fromJson(String source) => | ||
GenreModel.fromMap(json.decode(source)); | ||
|
||
@override | ||
String toString() { | ||
return 'GenreModel(objectId: $objectId, typeString: $typeString, typeBoolean: $typeBoolean, typeNumber: $typeNumber, typeDate: $typeDateTime, typeArray: $typeArray)'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:learning_about_b4a_flutter/app/core/models/shape_model.dart'; | ||
|
||
class PublisherModel { | ||
final String? objectId; | ||
final String? typeString; | ||
final bool? typeBoolean; | ||
final num? typeNumber; | ||
final DateTime? typeDateTime; | ||
final List<String>? typeArray; | ||
final ShapeModel? typePointerShape; | ||
PublisherModel({ | ||
this.objectId, | ||
this.typeString, | ||
this.typeBoolean, | ||
this.typeNumber, | ||
this.typeDateTime, | ||
this.typeArray, | ||
this.typePointerShape, | ||
}); | ||
|
||
PublisherModel copyWith({ | ||
String? objectId, | ||
String? typeString, | ||
bool? typeBoolean, | ||
num? typeNumber, | ||
DateTime? typeDate, | ||
List<String>? typeArray, | ||
ShapeModel? typePointerShape, | ||
}) { | ||
return PublisherModel( | ||
objectId: objectId ?? this.objectId, | ||
typeString: typeString ?? this.typeString, | ||
typeBoolean: typeBoolean ?? this.typeBoolean, | ||
typeNumber: typeNumber ?? this.typeNumber, | ||
typeDateTime: typeDate ?? typeDateTime, | ||
typeArray: typeArray ?? this.typeArray, | ||
typePointerShape: typePointerShape ?? this.typePointerShape, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toMap() { | ||
final result = <String, dynamic>{}; | ||
|
||
if (objectId != null) { | ||
result.addAll({'objectId': objectId}); | ||
} | ||
if (typeString != null) { | ||
result.addAll({'typeString': typeString}); | ||
} | ||
if (typeBoolean != null) { | ||
result.addAll({'typeBoolean': typeBoolean}); | ||
} | ||
if (typeNumber != null) { | ||
result.addAll({'typeNumber': typeNumber}); | ||
} | ||
if (typeDateTime != null) { | ||
result.addAll({'typeDate': typeDateTime!.millisecondsSinceEpoch}); | ||
} | ||
if (typeArray != null) { | ||
result.addAll({'typeArray': typeArray}); | ||
} | ||
if (typePointerShape != null) { | ||
result.addAll({'typePointerShape': typePointerShape!.toMap()}); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
factory PublisherModel.fromMap(Map<String, dynamic> map) { | ||
return PublisherModel( | ||
objectId: map['objectId'], | ||
typeString: map['typeString'], | ||
typeBoolean: map['typeBoolean'], | ||
typeNumber: map['typeNumber'], | ||
typeDateTime: map['typeDate'] != null | ||
? DateTime.fromMillisecondsSinceEpoch(map['typeDate']) | ||
: null, | ||
typeArray: List<String>.from(map['typeArray']), | ||
typePointerShape: map['typePointerShape'] != null | ||
? ShapeModel.fromMap(map['typePointerShape']) | ||
: null, | ||
); | ||
} | ||
|
||
String toJson() => json.encode(toMap()); | ||
|
||
factory PublisherModel.fromJson(String source) => | ||
PublisherModel.fromMap(json.decode(source)); | ||
|
||
@override | ||
String toString() { | ||
return 'PublisherModel(objectId: $objectId, typeString: $typeString, typeBoolean: $typeBoolean, typeNumber: $typeNumber, typeDate: $typeDateTime, typeArray: $typeArray, typePointerShape: $typePointerShape)'; | ||
} | ||
} |
Oops, something went wrong.