Adds a json serializable abstract class
This commit is contained in:
parent
5e6e47bd0a
commit
ad7da43a39
2 changed files with 22 additions and 1 deletions
21
lib/structs/JsonSerializable.dart
Normal file
21
lib/structs/JsonSerializable.dart
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
abstract class IJsonSerializable {
|
||||||
|
/// Encode json and return as String
|
||||||
|
String encode() {
|
||||||
|
return json.encode(toJson());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a Json Object
|
||||||
|
Map<String,dynamic> toJson();
|
||||||
|
|
||||||
|
/// Decodes json and returns the instance
|
||||||
|
static IJsonSerializable fromJson(String js) {
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Decodes json object
|
||||||
|
static IJsonSerializable decode(Map<String,dynamic> js) {
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
name: libac_dart
|
name: libac_dart
|
||||||
description: "Aria's Creations code library"
|
description: "Aria's Creations code library"
|
||||||
version: 1.2.071124+1630
|
version: 1.2.071224+2114
|
||||||
homepage: "https://zontreck.com"
|
homepage: "https://zontreck.com"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue