import AsyncStorage from '@react-native-async-storage/async-storage'; function clear() { return AsyncStorage.clear(); } function get(key, defaultValue = null) { console.log("get111111",key, defaultValue); return AsyncStorage.getItem(key).then(value => (value !== null ? JSON.parse(value) : defaultValue)); } function set(key, value) { return AsyncStorage.setItem(key, JSON.stringify(value)); } function remove(key) { return AsyncStorage.removeItem(key); } function multiGet(...keys) { return AsyncStorage.multiGet([...keys]).then(stores => { const data = {}; stores.forEach((result, index, store) => { data[store[index][0]] = JSON.parse(store[index][1]); }); return data; }); } function multiRemove(...keys) { return AsyncStorage.multiRemove([...keys]); } export default { clear, get, set, remove, multiGet, multiRemove };