1
0
mirror of https://github.com/go-vikunja/app synced 2024-06-01 10:16:53 +00:00
app-mirror-github/lib/models/namespace.dart
2018-09-17 18:16:50 +02:00

34 lines
921 B
Dart

import 'package:fluttering_vikunja/models/user.dart';
import 'package:meta/meta.dart';
class Namespace {
final int id;
final DateTime created, updated;
final String name, description;
final User owner;
Namespace(
{@required this.id,
this.created,
this.updated,
@required this.name,
this.description,
this.owner});
Namespace.fromJson(Map<String, dynamic> json)
: name = json['name'],
description = json['description'],
id = json['id'],
created = DateTime.fromMillisecondsSinceEpoch(json['created']),
updated = DateTime.fromMillisecondsSinceEpoch(json['updated']),
owner = User.fromJson(json['owner']);
toJSON() => {
"created": created?.millisecondsSinceEpoch,
"updated": updated?.millisecondsSinceEpoch,
"name": name,
"owner": owner?.toJSON(),
"description": description
};
}