coco_base_flutter 1.2.0
coco_base_flutter: ^1.2.0 copied to clipboard
The official Dart/Flutter SDK for CocoBase — BaaS with auth, realtime, storage, cloud functions and more.
1.2.0 #
Breaking #
initAuth()now returnsFuture<bool>instead ofFuture<void>— check the return value instead of callingisAuthenticated()after
New widgets (package:coco_base_flutter/widgets.dart) #
| Widget | What it does |
|---|---|
CocobaseQuery<T> |
Fetch-once widget — loads a collection and rebuilds when data arrives |
CocobaseLiveQuery<T> |
Real-time widget — stays in sync via WebSocket, no manual wiring |
CocobaseDocument<T> |
Fetches and displays a single document by ID |
CocobasePaginatedList<T> |
Paginated list with load-more or numbered page mode |
CocobaseInfiniteList<T> |
Auto-loads next page as user scrolls to the bottom |
CocobaseAuthBuilder |
Rebuilds on auth state change — renders auth/unauth/loading states |
CocobaseErrorWidget |
Typed error display with icon + retry button |
CocobaseFutureBuilder<T> |
Generic typed async wrapper for any CocoBase call |
CocobaseUserAvatar |
User avatar from data.avatar / data.avatar_url, falls back to initials |
New features #
onSnapshot— live query helper: fires immediately with current data then again on every create/update/delete. Returns a cancel function fordispose(). No manual WebSocket wiring neededpaginate— stateful pagination helper withnextPage(),prevPage(),goToPage(n), andreset(). Tracks position, detectshasMore, no backend changes requireddb.auth.onAuthStateChange(cb)— subscribe to auth changes and get back an unsubscribe function (same pattern as Firebase)- Typed error system — catch specific error types with
is:NotFoundError(404)UnauthorizedError(401)ForbiddenError(403)RateLimitError(429)ValidationError(422)ServerError(5xx)TimeoutError(timeout)- All extend
CocobaseError
timeoutconfig option — passtimeout: 10000toCocobaseConfigto set a per-request timeout in milliseconds (default 30 000)CollectionWatcher.onReconnect(cb)— get notified when the WebSocket reconnects after a dropped connectionPage<T>model — returned bypaginate()withdata,hasMore,page,pageSize,offset
Bug fixes #
initAuthnetwork safety — network errors, timeouts, and 5xx responses no longer log the user out. Only explicitUnauthorizedError/ForbiddenError(token rejected by server) clear the session- WebSocket infinite reconnect —
CollectionWatcher.disconnect()now correctly stops reconnection attempts (was reconnecting indefinitely after calling disconnect)
Other #
- Updated API base URL from
api.cocobase.buzz→api.cocobase.cc - Typed errors exported from main library barrel
1.1.0 #
- Moved authentication to a seperate class
- Implemented the new Version of realtime with room listing and broadcast functionality
- Added cloud function implementation
1.0.2 #
- Fixed null handling in AppUser and TokenResponse models to prevent type casting errors
- Improved error handling in login and register methods to gracefully handle edge cases
- Made getCurrentUser() calls optional in authentication flows to prevent cascading failures
- Enhanced AppUser.fromJson to accept both 'id' and '_id' field names for API compatibility
- Fixed TokenResponse.fromJson to handle camelCase and snake_case field variations
1.0.1 #
- Initial stable release with full authentication API
- Comprehensive QueryBuilder with 12 operators and filter maps
- Real-time WebSocket support with Connection lifecycle management
- Type-safe Document
- CocobaseConverters registry for automatic type conversion
- Complete API documentation and examples
0.0.1 #
- Initial project scaffold and basic setup