diff --git a/example/cubetiq_xlog_example.dart b/example/cubetiq_xlog_example.dart index f898ea5..5bfa9b6 100644 --- a/example/cubetiq_xlog_example.dart +++ b/example/cubetiq_xlog_example.dart @@ -1,3 +1,4 @@ +import 'package:cubetiq/src/json.dart'; import 'package:cubetiq/xlog.dart'; void main(List args) { @@ -15,17 +16,18 @@ void main(List args) { XLog.warning(null); - var json = Person(1, 'Sambo'); + var person = Person(1, 'Sambo'); - XLog.warning(json, [null, null]); + XLog.warning(person, [null, null]); } -class Person { +class Person implements ToJson { final id; final name; Person(this.id, this.name); + @override Map toJson() => { 'id': id, 'name': name, diff --git a/lib/interfaces.dart b/lib/interfaces.dart new file mode 100644 index 0000000..bdfec90 --- /dev/null +++ b/lib/interfaces.dart @@ -0,0 +1,3 @@ +library interfaces; + +export 'src/json.dart'; diff --git a/lib/src/json.dart b/lib/src/json.dart new file mode 100644 index 0000000..7c1530d --- /dev/null +++ b/lib/src/json.dart @@ -0,0 +1,3 @@ +abstract class ToJson { + Map toJson(); +}