sky_network 1.0.1 copy "sky_network: ^1.0.1" to clipboard
sky_network: ^1.0.1 copied to clipboard

A robust, decoupled remote network client wrapped around Dio and Connectivity.

sky_network #

A robust, type-safe, and fully decoupled remote network client wrapper around Dio and connectivity detection. It provides automatic error interception, standardized logging, and clean functional error returns.

Features #

  • Advanced Error Interceptors: Translates HTTP response codes and network failures (timeouts, dns resolution issues) into core domain Failure abstractions automatically.
  • Connectivity Aware: Integrated offline/online detection systems preventing unnecessary network calls when the device is disconnected.
  • Logging Pipeline: Ready-made, highly structured pretty_dio_logger support for debugging network requests in staging environments.

Getting Started #

Add the package to your pubspec.yaml:

dependencies:
  sky_network: ^1.0.0

Usage #

Instantiate and configure the type-safe client:

import 'package:sky_network/sky_network.dart';

void main() async {
  // 1. Initialize Network Client
  final networkClient = SkyNetworkClient(
    baseUrl: 'https://api.example.com/',
    interceptors: [
      PrettyDioLogger(requestHeader: true, requestBody: true),
    ],
  );

  // 2. Perform safe GET requests returning functional results
  final response = await networkClient.get<Map<String, dynamic>>('users/1');
  
  response.fold(
    (failure) => print('Failed with message: ${failure.message}'),
    (data) => print('Successfully retrieved user: $data'),
  );
}
0
likes
0
points
383
downloads

Publisher

verified publisherskycore.dev

Weekly Downloads

A robust, decoupled remote network client wrapped around Dio and Connectivity.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dio, flutter, fpdart, pretty_dio_logger, sky_architecture, sky_telemetry

More

Packages that depend on sky_network