data_cache 0.0.2 copy "data_cache: ^0.0.2" to clipboard
data_cache: ^0.0.2 copied to clipboard

cache data locally.

Features #

store cached varibles

Getting started #

    final cache=cacheManager({c0:[c0.fromMap,(c0 x)=>x.toMap()]});
    await Future.delayed(Duration(milliseconds: 500));
    cache.check();
    expect(cache.get<c0>("id0"), null);
    cache.addOrUpdate<c0>(c0("id0", 1));
    cache.check();
    expect(cache.get<c0>("id0").toString(), c0("id0", 1));
final cache=cacheManager({
      c0:[(c0 x)=>x.toMap(),c0.fromMap],
      c1:[(c1 x)=>x.toMap(),c1.fromMap],
    });
    await Future.delayed(Duration(milliseconds: 500));
    cache.check();
    // expect(cache.get<c0>("id0"), null);
    cache.addOrUpdate<c0>(c0("id0", 1));
    cache.addOrUpdate<c1>(c1("id01", "a instance"));
    cache.check();
    cache.update(c1, "id01", {"name":"an instance"});
    print(cache.get<c1>("id01")?.toMap());
    cache.check();

Usage #

Additional information #

0
likes
0
pub points
1%
popularity

Publisher

unverified uploader

cache data locally.

License

unknown (LICENSE)

Dependencies

flutter, shared_preferences

More

Packages that depend on data_cache