zeba_academy_network_helper 0.0.1 copy "zeba_academy_network_helper: ^0.0.1" to clipboard
zeba_academy_network_helper: ^0.0.1 copied to clipboard

A Flutter package to simplify network requests with automatic JSON parsing, error handling, retries, and logging.

Zeba Academy Network Helper #

A Flutter package to simplify network requests with automatic JSON parsing, retry logic, error handling, and optional logging. Designed to help developers make GET, POST, PUT, DELETE requests effortlessly, while keeping your code clean and minimal.


Features #

  • Simple functions for GET, POST, PUT, DELETE requests.
  • Automatic JSON parsing for responses.
  • Retry logic for failed requests.
  • Connectivity checks to prevent requests without internet.
  • Optional logging for debugging network calls.
  • Minimal, no-bloat, production-ready code.

Installation #

Add the package to your pubspec.yaml:

dependencies:
  zeba_academy_network_helper:
    git:
      url: https://github.com/sufyanism/zeba_academy_network_helper.git

Then run:

flutter pub get

Usage #

Import #

import 'package:zeba_academy_network_helper/zeba_academy_network_helper.dart';

Initialize #

final networkHelper = ZebaNetworkHelper(
  retryCount: 3,       // Number of retry attempts
  enableLogging: true, // Enable request/response logging
);

GET Request #

final response = await networkHelper.get('https://jsonplaceholder.typicode.com/posts/1');
print(response);

POST Request #

final response = await networkHelper.post(
  'https://jsonplaceholder.typicode.com/posts',
  body: {'title': 'Hello', 'body': 'World', 'userId': 1},
);
print(response);

PUT Request #

final response = await networkHelper.put(
  'https://jsonplaceholder.typicode.com/posts/1',
  body: {'title': 'Updated Title'},
);
print(response);

DELETE Request #

final response = await networkHelper.delete('https://jsonplaceholder.typicode.com/posts/1');
print(response);

Notes #

  • Ensure the device has an active internet connection, otherwise a SocketException will be thrown.
  • Logging is optional and can be enabled via the enableLogging parameter.
  • Retry attempts can be configured with the retryCount parameter.

License #

This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See LICENSE for more details.


About Me #

✨ I’m Sufyan bin Uzayr, an open-source developer passionate about building and sharing meaningful projects. You can learn more about me and my work at sufyanism.com or connect with me on LinkedIn.


Your all-in-one no-bloat hub! #

šŸš€ Explore cutting-edge resources in coding, tech, and development at zeba.academy and code.zeba.academy. Empower yourself with practical skills through curated directives, real-world projects, and hands-on experience. Level up your tech game today! šŸ’»āœØ

Thank you for visiting!

0
likes
130
points
0
downloads

Documentation

API reference

Publisher

verified publisherzeba.academy

Weekly Downloads

A Flutter package to simplify network requests with automatic JSON parsing, error handling, retries, and logging.

Homepage

License

GPL-3.0 (license)

Dependencies

connectivity_plus, flutter, http, logger

More

Packages that depend on zeba_academy_network_helper