Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Hameed Abdullateef

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Syncache

An offline-first cache and sync engine for Dart and Flutter applications.

## Packages

| Package | Description | pub.dev |
|---------|-------------|---------|
| [syncache](packages/syncache) | Core caching library for Dart | [![pub package](https://img.shields.io/pub/v/syncache.svg)](https://pub.dev/packages/syncache) |
| [syncache_flutter](packages/syncache_flutter) | Flutter integration with widgets and lifecycle management | [![pub package](https://img.shields.io/pub/v/syncache_flutter.svg)](https://pub.dev/packages/syncache_flutter) |

## Features

- **Multiple caching policies** - offlineFirst, cacheOnly, networkOnly, refresh, staleWhileRefresh
- **Reactive streams** - Subscribe to cache updates with `watch()`
- **Optimistic mutations** - Update UI immediately while syncing in background
- **Tag-based invalidation** - Group and invalidate related cache entries
- **Flutter integration** - Widgets, lifecycle management, connectivity detection

## Quick Start

### Dart

```yaml
dependencies:
syncache: ^0.1.0
```

```dart
import 'package:syncache/syncache.dart';

final cache = Syncache<User>(store: MemoryStore<User>());

// Fetch with offline-first policy
final user = await cache.get(
key: 'user:123',
fetch: (request) => api.getUser(123),
);
```

### Flutter

```yaml
dependencies:
syncache: ^0.1.0
syncache_flutter: ^0.1.0
```

```dart
import 'package:syncache/syncache.dart';
import 'package:syncache_flutter/syncache_flutter.dart';

// Provide cache to widget tree
SyncacheScope<User>(
cache: userCache,
network: FlutterNetwork(),
child: MyApp(),
)

// Display cached data reactively
CacheBuilder<User>(
cacheKey: 'user:123',
fetch: (request) => api.getUser(123),
builder: (context, snapshot) {
if (!snapshot.hasData) return CircularProgressIndicator();
return Text(snapshot.data!.name);
},
)
```

## Documentation

- [syncache documentation](packages/syncache/README.md)
- [syncache_flutter documentation](packages/syncache_flutter/README.md)

## License

MIT License - see [LICENSE](LICENSE) for details.
Loading