mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: use json_serializable
This commit is contained in:
@@ -51,3 +51,25 @@ class SnippetAdapter extends TypeAdapter<Snippet> {
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
Snippet _$SnippetFromJson(Map<String, dynamic> json) => Snippet(
|
||||
name: json['name'] as String,
|
||||
script: json['script'] as String,
|
||||
tags: (json['tags'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
||||
note: json['note'] as String?,
|
||||
autoRunOn: (json['autoRunOn'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SnippetToJson(Snippet instance) => <String, dynamic>{
|
||||
'name': instance.name,
|
||||
'script': instance.script,
|
||||
'tags': instance.tags,
|
||||
'note': instance.note,
|
||||
'autoRunOn': instance.autoRunOn,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user