bifrosted 0.5.4
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/fetchListsignatures
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:isolatedependency in bifrosted itself
- Defaults to synchronous
0.5.0 #
- Breaking: Removed
dart:iodependency - now works on web/Jaspr - Breaking:
post/put/patch/deletebody is nowObject?instead ofString?- Maps and Lists are auto-encoded to JSON
- Strings are sent as-is
- Breaking: Removed
Deserializerclass - 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 returnbool - Both
mutateandsendacceptinvalidateKeysfor automatic cache invalidation - Added in-memory singleton cache for deserialized objects
BifrostRepository.clearMemoryCache()to resetuseMemoryCacheparameter onfetch/fetchListto opt out per call
clearAllCache()now only removes bifrost-prefixed keys (no longer wipes all storage)DeserializationExceptionis 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 instancesuseRealClient()- Reset to real HTTP clientssetClientFactory()- Set custom client factory- No more per-API client overrides needed
0.2.2 #
- Fixed build.yaml to correctly combine generated code into
.g.dartfiles- Changed
build_to: cacheandbuild_extensions: .fake.g.part - Generator output now properly merges with json_serializable/freezed
- Changed
0.2.1 #
- Added
build.yamlfor 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
@generateFakeannotation for code generation - Added
FakeUtilsutility class (usesfakerpackage)fakeForKey(String key)- generates fake data based on field namecreate<T>()- generates fake model from factoryfakeJson()/fakeJsonList()- generic JSON generators
- Added
FakeGeneratorfor build_runner integration- Generates
.fake()extension methods for annotated classes - Works with freezed models
- Generates
0.1.1 #
- Updated README
0.1.0 #
- Initial release
RestAPIabstract class for REST API clients- GET, POST, PUT, PATCH, DELETE methods
- Automatic error handling and logging
- Header management with extra headers support
BifrostRepositoryfor repository pattern with cachingfetch<T>()andfetchList<T>()for automatic deserialization- Offline-first with cache fallback
- Automatic cache expiration
SystemNotifierinterface for global error handlingonNetworkError(),onUnauthorized(),onForbidden()onServerError(),onApiError()
StorageServiceinterface for pluggable storage backendsConnectionCheckerinterface for connectivity detection- Uses
loggerpackage for logging - Comprehensive test suite