coco_base_flutter 1.2.0 copy "coco_base_flutter: ^1.2.0" to clipboard
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 returns Future<bool> instead of Future<void> — check the return value instead of calling isAuthenticated() 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 for dispose(). No manual WebSocket wiring needed
  • paginate — stateful pagination helper with nextPage(), prevPage(), goToPage(n), and reset(). Tracks position, detects hasMore, no backend changes required
  • db.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
  • timeout config option — pass timeout: 10000 to CocobaseConfig to set a per-request timeout in milliseconds (default 30 000)
  • CollectionWatcher.onReconnect(cb) — get notified when the WebSocket reconnects after a dropped connection
  • Page<T> model — returned by paginate() with data, hasMore, page, pageSize, offset

Bug fixes #

  • initAuth network safety — network errors, timeouts, and 5xx responses no longer log the user out. Only explicit UnauthorizedError/ForbiddenError (token rejected by server) clear the session
  • WebSocket infinite reconnectCollectionWatcher.disconnect() now correctly stops reconnection attempts (was reconnecting indefinitely after calling disconnect)

Other #

  • Updated API base URL from api.cocobase.buzzapi.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
1
likes
120
points
51
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

The official Dart/Flutter SDK for CocoBase — BaaS with auth, realtime, storage, cloud functions and more.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dio, flutter, web_socket_channel

More

Packages that depend on coco_base_flutter