-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#62) : fixes the models by creating them by using the freezed and…
… injected
- Loading branch information
Showing
18 changed files
with
262 additions
and
191 deletions.
There are no files selected for viewing
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
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,3 @@ | ||
#!/bin/bash | ||
|
||
flutter pub run build_runner build --delete-conflicting-outputs |
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
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
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,53 @@ | ||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:parental_control/services/app_usage_local_service.dart'; | ||
|
||
part 'child_model.freezed.dart'; | ||
part 'child_model.g.dart'; | ||
|
||
@freezed | ||
class ChildModel with _$ChildModel { | ||
// ignore: invalid_annotation_target | ||
@JsonSerializable(explicitToJson: true) | ||
const factory ChildModel({ | ||
required final String id, | ||
required final String name, | ||
required final String email, | ||
required final String? image, | ||
final String? token, | ||
@Default(<AppUsageInfo>[]) | ||
@AppUsageInfoConverter() | ||
List<AppUsageInfo> appsUsageModel, | ||
@GeoPointConverter() final GeoPoint? position, | ||
}) = _ChildModel; | ||
|
||
factory ChildModel.fromJson(Map<String, Object?> json) => | ||
_$ChildModelFromJson(json); | ||
} | ||
|
||
class GeoPointConverter implements JsonConverter<GeoPoint?, GeoPoint?> { | ||
const GeoPointConverter(); | ||
|
||
@override | ||
GeoPoint? fromJson(GeoPoint? geoPoint) { | ||
return geoPoint; | ||
} | ||
|
||
@override | ||
GeoPoint? toJson(GeoPoint? geoPoint) => geoPoint; | ||
} | ||
|
||
class AppUsageInfoConverter | ||
implements JsonConverter<AppUsageInfo, Map<String, dynamic>> { | ||
const AppUsageInfoConverter(); | ||
|
||
@override | ||
AppUsageInfo fromJson(Map<String, dynamic> json) { | ||
return AppUsageInfo.fromMap(json); | ||
} | ||
|
||
@override | ||
Map<String, dynamic> toJson(AppUsageInfo appUsageInfo) { | ||
return appUsageInfo.toMap(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
part 'notification_model.freezed.dart'; | ||
part 'notification_model.g.dart'; | ||
|
||
@freezed | ||
class NotificationModel with _$NotificationModel { | ||
// ignore: invalid_annotation_target | ||
@JsonSerializable(explicitToJson: true) | ||
const factory NotificationModel({ | ||
required final String? title, | ||
required final String? body, | ||
required final String? message, | ||
required final String? id, | ||
}) = _NotificationModel; | ||
|
||
factory NotificationModel.fromJson(Map<String, Object?> json) => | ||
_$NotificationModelFromJson(json); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.