get method

Future<T?> get(
  1. String itemName
)

Implementation

Future<T?> get(String itemName) async {
  try {
    final directory = await _localDirectory;
    final file = File('${directory.path}/$itemName');
    if (!file.existsSync()) {
      return null;
    }
    final bytes = await file.readAsBytes();
    final data = deserialize(bytes);
    return data as T?;
  } catch (e) {
    print("Error loading data: $e");
    return null;
  }
}