mirror of
https://bitbucket.org/FransoletThomas/tablet-app.git
synced 2025-12-06 16:41:19 +00:00
42 lines
1.2 KiB
Dart
42 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:managerapi/api.dart';
|
|
import 'package:tablet_app/client.dart';
|
|
import 'dart:convert';
|
|
|
|
|
|
class TabletAppContext with ChangeNotifier{
|
|
Client clientAPI;
|
|
String id;
|
|
String host;
|
|
ConfigurationDTO configuration;
|
|
String language;
|
|
String deviceId;
|
|
|
|
TabletAppContext({this.id, this.deviceId, this.host, this.configuration, this.language});
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'id': id,
|
|
'deviceId': deviceId,
|
|
'host': host,
|
|
'configuration': configuration == null ? null : jsonEncode(configuration.toJson()),
|
|
'language': language
|
|
};
|
|
}
|
|
|
|
factory TabletAppContext.fromJson(Map<String, dynamic> json) {
|
|
return new TabletAppContext(
|
|
id: json['id'] as String,
|
|
deviceId: json['deviceId'] as String,
|
|
host: json['host'] as String,
|
|
configuration: json['configuration'] == null ? null : ConfigurationDTO.fromJson(json['configuration']),
|
|
language: json['language'] as String
|
|
);
|
|
}
|
|
|
|
// Implement toString to make it easier to see information about
|
|
@override
|
|
String toString() {
|
|
return 'TabletAppContext{id: $id, deviceId: $deviceId, selectedConfiguration: $configuration, language: $language, host: $host}';
|
|
}
|
|
} |