From f5ed617bace9cb881e31ba9dd3231b5c2d0d40a4 Mon Sep 17 00:00:00 2001 From: truonghoangduy Date: Thu, 20 Oct 2022 08:05:00 +0700 Subject: [PATCH] fix datatype convert --- lib/core/ble_repository.dart | 2 +- lib/main.dart | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/core/ble_repository.dart b/lib/core/ble_repository.dart index eeb4cb5..094f59c 100644 --- a/lib/core/ble_repository.dart +++ b/lib/core/ble_repository.dart @@ -41,7 +41,7 @@ class BleRepository { _listObdCharacteristicStream.add(obdStream.listen((event) { obd2ReaderState.add(event); final dataAsString = String.fromCharCodes(event.data); - final obdData = int.parse((dataAsString)); + final obdData = double.parse((dataAsString)).toInt(); checkListCore.addCheckListData(event.type, obdData); })); } diff --git a/lib/main.dart b/lib/main.dart index b4f5c57..d26e619 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,6 +17,7 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return Provider( + lazy: false, create: (BuildContext context) { return CheckListCore() ..createCheckListStore()