fix: improve null checks in localization storage updates
This commit is contained in:
parent
09c2d2018b
commit
25c316ef79
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: curly_braces_in_flow_control_structures
|
||||||
|
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -272,10 +274,11 @@ class LocalizationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> _updateStorageUtil(Map<String, dynamic> jsonBody) async {
|
static Future<void> _updateStorageUtil(Map<String, dynamic> jsonBody) async {
|
||||||
await StorageHelper.instance.set(SQLiteStorageKey.whatsapp.value, jsonBody['whatsapp'] ? 'true' : 'false', Storage.SQLiteStorage);
|
await StorageHelper.instance.set(SQLiteStorageKey.whatsapp.value, jsonBody['whatsapp'] == true && jsonBody['whatsapp'] != null ? 'true' : 'false', Storage.SQLiteStorage);
|
||||||
await StorageHelper.instance.set(SQLiteStorageKey.provisional.value, jsonBody['provisional'] ? 'true' : 'false', Storage.SQLiteStorage);
|
await StorageHelper.instance.set(SQLiteStorageKey.provisional.value, jsonBody['provisional'] == true && jsonBody['provisional'] != null ? 'true' : 'false', Storage.SQLiteStorage);
|
||||||
await StorageHelper.instance.set(SQLiteStorageKey.pets.value, jsonBody['pet'] ? 'true' : 'false', Storage.SQLiteStorage);
|
await StorageHelper.instance.set(SQLiteStorageKey.pets.value, jsonBody['pet'] == true && jsonBody['pet'] != null ? 'true' : 'false', Storage.SQLiteStorage);
|
||||||
await StorageHelper.instance.set(SQLiteStorageKey.petAmount.value, jsonBody['petAmountRegister'].toString().isEmpty ? '0' : jsonBody['petAmountRegister'].toString(), Storage.SQLiteStorage);
|
await StorageHelper.instance.set(SQLiteStorageKey.petAmount.value, jsonBody['petAmountRegister'].toString().isEmpty ? '0' : jsonBody['petAmountRegister'].toString(), Storage.SQLiteStorage);
|
||||||
await StorageHelper.instance.set(SQLiteStorageKey.userName.value, jsonBody['visitado']['VDO_NOME'], Storage.SQLiteStorage);
|
await StorageHelper.instance.set(SQLiteStorageKey.userName.value, jsonBody['visitado']['VDO_NOME'], Storage.SQLiteStorage);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue