39 lines
1.1 KiB
Dart
39 lines
1.1 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:manager_api/api.dart';
|
|
|
|
class VisitAppContext with ChangeNotifier{
|
|
String? id = "";
|
|
//String? token = "";
|
|
//String? host = "";
|
|
String? language = "";
|
|
List<ConfigurationDTO>? configurations;
|
|
ConfigurationDTO? configuration;
|
|
|
|
VisitAppContext({this.language, this.id, this.configuration});
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'id': id,
|
|
//'host': host,
|
|
'language': language,
|
|
//'configuration': configuration == null ? null : jsonEncode(configuration?.toJson()),
|
|
};
|
|
}
|
|
|
|
factory VisitAppContext.fromJson(Map<String, dynamic> json) {
|
|
return VisitAppContext(
|
|
id: json['id'] as String,
|
|
/*host: json['host'] as String,*/
|
|
language: json['language'] as String,
|
|
configuration: json['configuration'] == null ? null : ConfigurationDTO.fromJson(json['configuration']),
|
|
);
|
|
}
|
|
|
|
// Implement toString to make it easier to see information about
|
|
@override
|
|
String toString() {
|
|
return 'VisitAppContext{id: $id, language: $language, configuration: $configuration}';
|
|
}
|
|
} |