one_request 3.1.0
one_request: ^3.1.0 copied to clipboard
Flutter HTTP, optional WebSocket, and optional connectivity notices. One import; every feature can be skipped or turned off.
Changelog #
3.1.0 - 2026-09-21 #
Added #
- Optional WebSocket via
OneRequest.socket()/OneSocket(web_socket_channel). Nothing connects until you call it.configure(enableWebSocket: false)hard-disables. JSON encode/decode on by default;autoReconnectoff by default. - Optional connectivity notices via
connectivity_plus. Off untilsetConnectivity()orconfigure(enableConnectivity: true). Default UI is snackbar; chooseConnectivityUi.popover,banner,none, or a custombuilder.clearConnectivity()turns it off. OneRequest.connectivityOverlayfor apps that skipwrap()/ EasyLoading.
Fixed #
- Example app includes
flutter_lintssodart format .no longer warns about an unresolvedanalysis_options.yaml.
Changed #
- README lists every optional HTTP, WebSocket, and connectivity knob; example app demonstrates toggling them.
- Compatibility script and CI also analyze the example and run socket/connectivity tests on Chrome (
flutter test -d chrome). - Require
connectivity_plus^7.1.0so thesatellitenetwork kind exists at the constraint lower bound (pub points). configure(baseUrl:)prefixes relative paths only. Absolutehttp(s):///ws(s)://URLs are left alone so a second service is not concatenated onto the first.
Added #
OneRequest(baseUrl:, headers:)for one client per backend.openSocket()uses that instance.OneRequest.socket(baseUrl:)overrides the default without changing HTTP config. MultipleOneSocketinstances can stay open on different hosts.
3.0.0 - 2026-09-03 #
Breaking changes #
- Replaced
either_dartwithdart_either^2.3.0. sendandbatchnow returnEither<String, T>: Left is the error, Right is the data.folduses named callbacks:fold(ifLeft: ..., ifRight: ...).- Use
getOrNull()/leftOrNull()instead of.left/.right. - If you treated
isLeftas success, switch toisRight, or userequest<T>()which throwsRequestException.
Added #
OneRequest.request<T>()— returns data or throwsRequestException.RequestExceptionandRestErrorParserfor Django REST / JSON payloads (error,detail,details,code,data).OneRequest.setAuth(...)— optional JWT header + single-flight refresh on 401.OneRequest.wrap()— optional EasyLoading builder forMaterialApp/GetMaterialApp.fileFromPath,fileFromByte,fileFormString,unwrapPayload,innerData,OneRequest.client.clearErrorHandler()and additivesetErrorHandler(clearHandler/clearLogger).- Re-exports Dio, Either, and EasyLoading types from
package:one_request/one_request.dart(do not add those packages yourself). - Runs on Android, iOS, web, Windows, macOS, and Linux.
Changed #
- Default error handler is
RestErrorParser.handler(replace or clear from the app). - Global interceptors from
configure()attach once on the shared Dio client. - Loading UI is initialized only when you use
wrap/initLoading, or when a request actually shows a loader/overlay. file()andfileFromPath()requiredart:io(mobile/desktop). On web usefileFromByteorfileFormString.- Dependencies:
dio^5.11.0,flutter_easyloading^4.0.2,dart_either^2.3.0. - SDK
>=3.6.0, Flutter>=3.27.0.
2.3.0 - 2026-05-17 #
Added #
- Global request defaults on
configure(): timeout, retries, retry delay, max redirects, cache. - Error message controls:
sanitizeErrorMessages,maxErrorMessageLength,showStatusCodeInError.
Fixed #
- GET cache returns before hitting the network.
- Error extraction no longer surfaces raw HTML payloads.
- Error overlays go through
LoadingStuff.showError(...). - Replaced
printwithdebugPrint.
Changed #
- Updated dependencies and SDK constraints.
2.2.1 - 2025-12-02 #
2.2.0 - 2025-11-06 #
Added #
- Separate error and response loggers.
- Colored request / response / error logs.
- Global overlay on/off controls.
- Automatic redirect following.
Changed #
- Request logging turns on when any logger is enabled.
Older versions #
- 2.1.0 — retries, cache, batch requests.
- 2.0.x — error handling updates.
- 1.0.x — first stable API and overlays.
- 0.0.x — early releases.