'Flutter freezed json generator with mixin good practice to use
How I can use mixin in my freezed class for good json convertion varibels from mixin! how i can use converter there?
import 'package:freezed_annotation/freezed_annotation.dart';
part 'aqsp_stage.freezed.dart';
part 'aqsp_stage.g.dart';
@freezed
class AQSPStage with _$AQSPStage, AQSPStageMixin {
const factory AQSPStage.notify({
required String message,
@Default(AQNotificationType.notify) AQNotificationType aqNotificationType,
}) = NotifyStage;
const factory AQSPStage.form({
})=DataStage;
factory AQSPStage.fromJson(Map<String, dynamic> json) =>
_$AQSPStageFromJson(json);
}
enum AQNotificationType {
email,
snackBar,
alert,
notify,
}
mixin AQSPStageMixin{
String? _id;
set setId(String id)=> _id=id;
String? get getID=> _id;
}
My mixin it without converter. it is posible?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|