bifrosted 0.5.4 copy "bifrosted: ^0.5.4" to clipboard
bifrosted: ^0.5.4 copied to clipboard

The rainbow bridge connecting your app to APIs. A lightweight REST API client and repository pattern with caching, offline support, and error handling.

Changelog #

0.5.2 #

  • Removed unwrapResponse() override
  • Removed in-memory singleton cache (_memoryCache, clearMemoryCache, useMemoryCache)
  • Simplified fetch/fetchList signatures

0.5.1 #

  • Added bifrostJsonDecode - Global async JSON decoder
    • Defaults to synchronous jsonDecode (works everywhere)
    • Override to decode on a background isolate for large payloads:
      // Dart:
      bifrostJsonDecode = (body) => Isolate.run(() => jsonDecode(body));
      
      // Flutter:
      bifrostJsonDecode = (body) => compute(jsonDecode, body);
      
    • Web-safe: no dart:isolate dependency in bifrosted itself

0.5.0 #

  • Breaking: Removed dart:io dependency - now works on web/Jaspr
  • Breaking: post/put/patch/delete body is now Object? instead of String?
    • Maps and Lists are auto-encoded to JSON
    • Strings are sent as-is
  • Breaking: Removed Deserializer class - deserialization is now inlined
  • Added unwrapResponse() override for wrapped API responses ({"data": {...}})
  • Added mutate<T>() for write operations (POST/PUT/PATCH/DELETE) with optional deserialization
  • Added send() for fire-and-forget writes that return bool
  • Both mutate and send accept invalidateKeys for automatic cache invalidation
  • Added in-memory singleton cache for deserialized objects
    • BifrostRepository.clearMemoryCache() to reset
    • useMemoryCache parameter on fetch/fetchList to opt out per call
  • clearAllCache() now only removes bifrost-prefixed keys (no longer wipes all storage)
  • DeserializationException is still exported for custom use

0.4.5 #

  • update dependencies

0.4.0 #

  • Breaking: Removed generics from BifrostRepository
  • Added bifrostServiceLocator - Set once, used everywhere
    // At app startup:
    bifrostServiceLocator = <T>() => Get.find<T>();
    
  • Repositories now have zero boilerplate:
    class UserRepo extends BifrostRepository {
      Future<User?> getUser(String id) => fetch<User>(...);
    }
    

0.3.0 #

  • Added global mock client support for testing
    • useMockClient() - Enable mock responses for all RestAPI instances
    • useRealClient() - Reset to real HTTP clients
    • setClientFactory() - Set custom client factory
    • No more per-API client overrides needed

0.2.2 #

  • Fixed build.yaml to correctly combine generated code into .g.dart files
    • Changed build_to: cache and build_extensions: .fake.g.part
    • Generator output now properly merges with json_serializable/freezed

0.2.1 #

  • Added build.yaml for auto-discovery by build_runner
    • No manual configuration needed - just add the dependency and run build_runner
    • Works like freezed/json_serializable out of the box

0.2.0 #

  • Added @generateFake annotation for code generation
  • Added FakeUtils utility class (uses faker package)
    • fakeForKey(String key) - generates fake data based on field name
    • create<T>() - generates fake model from factory
    • fakeJson() / fakeJsonList() - generic JSON generators
  • Added FakeGenerator for build_runner integration
    • Generates .fake() extension methods for annotated classes
    • Works with freezed models

0.1.1 #

  • Updated README

0.1.0 #

  • Initial release
  • RestAPI abstract class for REST API clients
    • GET, POST, PUT, PATCH, DELETE methods
    • Automatic error handling and logging
    • Header management with extra headers support
  • BifrostRepository for repository pattern with caching
    • fetch<T>() and fetchList<T>() for automatic deserialization
    • Offline-first with cache fallback
    • Automatic cache expiration
  • SystemNotifier interface for global error handling
    • onNetworkError(), onUnauthorized(), onForbidden()
    • onServerError(), onApiError()
  • StorageService interface for pluggable storage backends
  • ConnectionChecker interface for connectivity detection
  • Uses logger package for logging
  • Comprehensive test suite
0
likes
105
points
40
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

The rainbow bridge connecting your app to APIs. A lightweight REST API client and repository pattern with caching, offline support, and error handling.

Repository (GitHub)
View/report issues

Topics

#api #http #rest #repository #caching

License

MIT (license)

Dependencies

analyzer, build, faker, flutter, http, logger, share_plus, source_gen, web

More

Packages that depend on bifrosted