You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
healthcare-frontend/lib/models/bmi_history_model.dart

50 lines
1.4 KiB

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class BmiHistoryModel {
String bmiValue = '';
String height= '';
String weight= '';
String date= '';
String displayDate='';
DateTime dateForFilter=new DateTime.now();
var number1;
var number2;
BmiHistoryModel();
factory BmiHistoryModel.fromJson(Map<String, dynamic> json){
BmiHistoryModel rtvm = new BmiHistoryModel();
/*"heightUnit": "feet",
"weightUnit": "kg",
"_id": "6493fe48eca67b71b8444e24",
"bmiinfoid": "BMI1687420488845468",
"customerId": "AHSUSNE2",
"height": "164.592",
"weight": "50",
"age": 27,
"bmivalue": 18.46,
"createdAt": "2023-06-22T07:54:48.847Z",
"updatedAt": "2023-06-22T07:54:48.847Z",*/
rtvm.bmiValue = json['bmivalue'].toString() ?? '';
rtvm.height = json['height'].toString() ?? '';
rtvm.weight = json['weight'].toString() ?? '';
rtvm.number1 = double.parse( rtvm.bmiValue);
rtvm.number2 = double.parse( rtvm.bmiValue);
rtvm.date = json['createdAt'].toString() ?? '';
//DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(rtvm.date);
DateTime parseDate = new DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(rtvm.date);
var outputFormat = DateFormat('MM/dd/yyyy hh:mm a');
rtvm.dateForFilter=parseDate;
var outputDate = outputFormat.format(parseDate);
rtvm.displayDate=outputDate;
return rtvm;
}
}