resto5_models 0.0.2+8 resto5_models: ^0.0.2+8 copied to clipboard
This package exposes all models and utily methods provided and used by Restomax 5
example/resto5_models_example.dart
import 'dart:convert';
import 'package:resto5_models/resto5_models.dart' show RMXData;
const String resto5WSPath = "https://RESTOMAX_ADDRESS:RESTOMAX_PORT";
Future<Map<String, dynamic>?> getData() async {
final Uri url = Uri.parse('$resto5WSPath/getData');
final Map<String, String> headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
};
try {
const dynamic http = {}; // For example api call
final response = await http.get(url, headers: headers);
return jsonDecode(response.body as String) as Map<String, dynamic>;
} catch (e) {
print(e.toString());
}
}
void main() {
getData().then((data) {
final restomaxdata = RMXData.fromJson(data);
print('Restomax Inf: ${restomaxdata.restomax.toJson()}');
print('Etab Inf: ${restomaxdata.etab.toJson()}');
});
}