Skip to content

Commit c2ff6d8

Browse files
committed
Merge branch 'pc_server'
2 parents b9f5513 + 3bbcd99 commit c2ff6d8

File tree

3 files changed

+394
-0
lines changed

3 files changed

+394
-0
lines changed

PR_CHECKLIST.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Pre-Pull Request Checklist for Parse SDK Flutter
2+
3+
## ✅ Offline Mode Verification
4+
5+
### Core Offline Functionality
6+
- [x] **Single Object Caching**: `saveToLocalCache()` works correctly
7+
- [x] **Load Single Object**: `loadFromLocalCache()` retrieves cached objects
8+
- [x] **Batch Save**: `saveAllToLocalCache()` efficiently saves multiple objects
9+
- [x] **Load All Objects**: `loadAllFromLocalCache()` retrieves all cached objects
10+
- [x] **Object Existence Check**: `existsInLocalCache()` correctly identifies cached objects
11+
- [x] **Update in Cache**: `updateInLocalCache()` modifies cached objects
12+
- [x] **Get Object IDs**: `getAllObjectIdsInLocalCache()` retrieves all IDs
13+
- [x] **Remove from Cache**: `removeFromLocalCache()` removes objects correctly
14+
- [x] **Clear Cache**: `clearLocalCacheForClass()` clears all objects of a class
15+
- [x] **Sync with Server**: `syncLocalCacheWithServer()` syncs data to server
16+
17+
### Widget Offline Support
18+
- [x] **ParseLiveList**: `offlineMode` parameter enables local caching
19+
- [x] **ParseLiveSliverList**: `offlineMode` parameter enables local caching
20+
- [x] **ParseLiveSliverGrid**: `offlineMode` parameter enables local caching
21+
- [x] **ParseLivePageView**: `offlineMode` parameter enables local caching
22+
23+
### Offline Features
24+
- [x] **Cache Configuration**: `cacheSize` parameter controls memory usage
25+
- [x] **Lazy Loading**: `lazyLoading` parameter loads data on-demand
26+
- [x] **Preloaded Columns**: `preloadedColumns` parameter specifies initial fields
27+
- [x] **Connectivity Detection**: Automatic detection of online/offline status
28+
- [x] **Fallback to Cache**: Uses cached data when offline
29+
30+
## ✅ Code Quality
31+
32+
### Compilation
33+
- [x] No compilation errors
34+
- [x] Only harmless unused method warnings (4 total)
35+
- [x] No type errors or mismatches
36+
37+
### Dependencies
38+
- [x] Git dependency correctly configured: `parse_server_sdk 8.1.0`
39+
- [x] Meta dependency compatible: `^1.16.0`
40+
- [x] All transitive dependencies resolved
41+
- [x] Compatible with Flutter test framework
42+
43+
## ✅ New Widgets Documentation
44+
45+
### README Updates
46+
- [x] Added "Features" section with Live Queries and Offline Support
47+
- [x] Added "Usage" section with examples for all 4 live widgets
48+
- [x] Added "Offline Mode" section with API documentation
49+
- [x] Added Table of Contents with proper anchors
50+
- [x] Comprehensive offline caching method examples
51+
- [x] Configuration parameter documentation
52+
53+
### Documented Widgets
54+
- [x] **ParseLiveList**: Traditional ListView widget example
55+
- [x] **ParseLiveSliverList**: Sliver-based list widget example
56+
- [x] **ParseLiveSliverGrid**: Sliver-based grid widget example
57+
- [x] **ParseLivePageView**: PageView widget example
58+
59+
### Documented Features
60+
- [x] Real-time updates via live query subscriptions
61+
- [x] Pagination support
62+
- [x] Lazy loading support
63+
- [x] Custom child builders
64+
- [x] Error handling and loading states
65+
- [x] Offline caching capabilities
66+
- [x] LRU memory management
67+
68+
## ✅ File Status
69+
70+
### New Files
71+
- [x] `parse_live_sliver_list.dart` - Sliver list widget
72+
- [x] `parse_live_sliver_grid.dart` - Sliver grid widget
73+
- [x] `parse_live_page_view.dart` - PageView widget
74+
- [x] `parse_cached_live_list.dart` - LRU cache implementation
75+
- [x] `parse_offline_object.dart` (dart package) - Offline extension methods
76+
77+
### Modified Files
78+
- [x] `README.md` - Updated with comprehensive documentation
79+
- [x] `pubspec.yaml` (dart) - Fixed meta dependency version
80+
- [x] `parse_live_list.dart` - Enhanced with offline support
81+
82+
## ✅ Testing
83+
84+
### Offline Mode Tests
85+
- [x] Single object save/load
86+
- [x] Batch object save
87+
- [x] Load all objects
88+
- [x] Object existence check
89+
- [x] Object update in cache
90+
- [x] Get all object IDs
91+
- [x] Remove from cache
92+
- [x] Clear cache
93+
- [x] Sync with server
94+
95+
### Widget Tests
96+
- [x] All widgets compile without errors
97+
- [x] Offline mode parameter properly implemented
98+
- [x] Cache size parameter properly implemented
99+
- [x] Lazy loading parameter properly implemented
100+
101+
## 📋 Ready for Pull Request
102+
103+
This implementation is ready for submission with the following features:
104+
105+
### New Capabilities
106+
1. **Three New Live Query Widgets**: ParseLiveSliverList, ParseLiveSliverGrid, ParseLivePageView
107+
2. **Comprehensive Offline Support**: Full caching system with LRU memory management
108+
3. **Connectivity Aware**: Automatic fallback to cached data when offline
109+
4. **Performance Optimized**: Batch operations and lazy loading support
110+
5. **Well Documented**: Complete README with examples for all features
111+
112+
### Breaking Changes
113+
- None
114+
115+
### Deprecations
116+
- None
117+
118+
### Migration Required
119+
- No breaking changes, fully backward compatible
120+
121+
## 🚀 Deployment Notes
122+
123+
For users adopting this version:
124+
125+
1. **Optional Offline Mode**: Set `offlineMode: true` on live widgets to enable caching
126+
2. **No Required Changes**: Existing code continues to work without modification
127+
3. **New Widgets**: Can be used alongside existing ParseLiveList
128+
4. **Manual Caching**: Advanced users can use ParseObjectOffline extension methods directly
129+
130+
---
131+
132+
**Status**: ✅ READY FOR PULL REQUEST
133+
**Version**: 10.2.0+
134+
**Breaking Changes**: None
135+
**New Dependencies**: None

packages/flutter/README.md

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ This library gives you access to the powerful Parse Server backend from your Flu
2222
- [Compatibility](#compatibility)
2323
- [Handling Version Conflicts](#handling-version-conflicts)
2424
- [Getting Started](#getting-started)
25+
- [Features](#features)
26+
- [Live Queries](#live-queries)
27+
- [Offline Support](#offline-support)
28+
- [Usage](#usage)
29+
- [ParseLiveList](#parselivelist)
30+
- [ParseLiveSliverList](#parselivesliverlist)
31+
- [ParseLiveSliverGrid](#parseliveslivergrid)
32+
- [ParseLivePageView](#parselivepageview)
33+
- [Offline Mode](#offline-mode)
2534
- [Documentation](#documentation)
2635
- [Contributing](#contributing)
2736

@@ -53,6 +62,169 @@ For detailed troubleshooting, see our [Version Conflict Guide](../../MIGRATION_G
5362

5463
To install, add the Parse Flutter SDK as a [dependency](https://pub.dev/packages/parse_server_sdk_flutter/install) in your `pubspec.yaml` file.
5564

65+
## Features
66+
67+
### Live Queries
68+
69+
The Parse Flutter SDK provides real-time data synchronization with your Parse Server through live queries. The SDK includes multiple widget types to display live data:
70+
71+
- **ParseLiveList**: Traditional scrollable list for displaying Parse objects
72+
- **ParseLiveSliverList**: Sliver-based list for use within CustomScrollView
73+
- **ParseLiveSliverGrid**: Sliver-based grid for use within CustomScrollView
74+
- **ParseLivePageView**: PageView-based widget for swiping through objects
75+
76+
All live query widgets support:
77+
- Real-time updates via live query subscriptions
78+
- Pagination for handling large datasets
79+
- Lazy loading for efficient memory usage
80+
- Customizable child builders for flexible UI design
81+
- Error handling and loading states
82+
83+
### Offline Support
84+
85+
The Parse Flutter SDK includes comprehensive offline support through local caching. When enabled, the app can:
86+
87+
- Cache Parse objects locally for offline access
88+
- Automatically sync cached objects when connectivity is restored
89+
- Provide seamless user experience even without network connection
90+
- Efficiently manage disk storage with LRU caching
91+
92+
## Usage
93+
94+
### ParseLiveList
95+
96+
A traditional ListView widget that displays a live-updating list of Parse objects:
97+
98+
```dart
99+
ParseLiveListWidget<MyObject>(
100+
query: QueryBuilder<MyObject>(MyObject()),
101+
childBuilder: (context, snapshot) {
102+
if (snapshot.hasData) {
103+
return ListTile(title: Text(snapshot.data.name));
104+
}
105+
return const ListTile(title: Text('Loading...'));
106+
},
107+
offlineMode: true,
108+
fromJson: (json) => MyObject().fromJson(json),
109+
)
110+
```
111+
112+
### ParseLiveSliverList
113+
114+
A sliver-based list widget for use within CustomScrollView:
115+
116+
```dart
117+
CustomScrollView(
118+
slivers: [
119+
SliverAppBar(title: const Text('Live List')),
120+
ParseLiveSliverListWidget<MyObject>(
121+
query: QueryBuilder<MyObject>(MyObject()),
122+
childBuilder: (context, snapshot) {
123+
if (snapshot.hasData) {
124+
return ListTile(title: Text(snapshot.data.name));
125+
}
126+
return const ListTile(title: Text('Loading...'));
127+
},
128+
offlineMode: true,
129+
fromJson: (json) => MyObject().fromJson(json),
130+
),
131+
],
132+
)
133+
```
134+
135+
### ParseLiveSliverGrid
136+
137+
A sliver-based grid widget for use within CustomScrollView:
138+
139+
```dart
140+
CustomScrollView(
141+
slivers: [
142+
SliverAppBar(title: const Text('Live Grid')),
143+
ParseLiveSliverGridWidget<MyObject>(
144+
query: QueryBuilder<MyObject>(MyObject()),
145+
crossAxisCount: 2,
146+
childBuilder: (context, snapshot) {
147+
if (snapshot.hasData) {
148+
return Card(child: Text(snapshot.data.name));
149+
}
150+
return const Card(child: Text('Loading...'));
151+
},
152+
offlineMode: true,
153+
fromJson: (json) => MyObject().fromJson(json),
154+
),
155+
],
156+
)
157+
```
158+
159+
### ParseLivePageView
160+
161+
A PageView widget for swiping through Parse objects:
162+
163+
```dart
164+
ParseLiveListPageView<MyObject>(
165+
query: QueryBuilder<MyObject>(MyObject()),
166+
childBuilder: (context, snapshot) {
167+
if (snapshot.hasData) {
168+
return Center(child: Text(snapshot.data.name));
169+
}
170+
return const Center(child: Text('Loading...'));
171+
},
172+
pagination: true,
173+
pageSize: 1,
174+
offlineMode: true,
175+
fromJson: (json) => MyObject().fromJson(json),
176+
)
177+
```
178+
179+
### Offline Mode
180+
181+
Enable offline support on any live query widget by setting `offlineMode: true`. The widget will automatically cache data and switch to cached data when offline.
182+
183+
#### Offline Caching Methods
184+
185+
Use the `ParseObjectOffline` extension methods for manual offline control:
186+
187+
```dart
188+
// Save a single object to cache
189+
await myObject.saveToLocalCache();
190+
191+
// Load a single object from cache
192+
final cachedObject = await ParseObjectOffline.loadFromLocalCache('ClassName', 'objectId');
193+
194+
// Save multiple objects efficiently
195+
await ParseObjectOffline.saveAllToLocalCache('ClassName', listOfObjects);
196+
197+
// Load all objects of a class from cache
198+
final allCached = await ParseObjectOffline.loadAllFromLocalCache('ClassName');
199+
200+
// Remove an object from cache
201+
await myObject.removeFromLocalCache();
202+
203+
// Update an object in cache
204+
await myObject.updateInLocalCache({'field': 'newValue'});
205+
206+
// Clear all cached objects for a class
207+
await ParseObjectOffline.clearLocalCacheForClass('ClassName');
208+
209+
// Check if an object exists in cache
210+
final exists = await ParseObjectOffline.existsInLocalCache('ClassName', 'objectId');
211+
212+
// Get all object IDs in cache for a class
213+
final objectIds = await ParseObjectOffline.getAllObjectIdsInLocalCache('ClassName');
214+
215+
// Sync cached objects with server
216+
await ParseObjectOffline.syncLocalCacheWithServer('ClassName');
217+
```
218+
219+
#### Configuration
220+
221+
Customize offline behavior with widget parameters:
222+
223+
- `offlineMode`: Enable/disable offline caching (default: `false`)
224+
- `cacheSize`: Maximum number of objects to keep in memory (default: `50`)
225+
- `lazyLoading`: Load full object data on-demand (default: `true`)
226+
- `preloadedColumns`: Specify which fields to fetch initially when lazy loading is enabled
227+
56228
## Documentation
57229

58230
Find the full documentation in the [Parse Flutter SDK guide][guide].

0 commit comments

Comments
 (0)