api_join

A Flutter package that simplifies API operations with clean, reusable methods for GET, POST, PUT, and DELETE requests. This package provides an easy-to-use interface for handling API responses and error states.

Features

  • Simple and intuitive API request methods
  • Automatic JSON parsing and error handling
  • Unified response format for all API calls
  • Support for custom headers and request body
  • Built-in status code handling and success validation
  • Type-safe response handling

Getting started

Add this to your package's pubspec.yaml file:

dependencies:
  api_join: ^0.0.1

Install it:

flutter pub get

Usage

import 'package:api_join/api_join.dart';

// GET Request
final getResponse = await ApiJoin.get(
  'https://api.example.com/users',
  headers: {'Authorization': 'Bearer your_token'},
);

if (getResponse.success) {
  print('Status Code: ${getResponse.statusCode}');
  print('Data: ${getResponse.data}');
}

// POST Request
final postResponse = await ApiJoin.post(
  'https://api.example.com/users',
  body: {
    'name': 'John Doe',
    'email': 'john@example.com',
  },
);

if (postResponse.success) {
  print('Created User: ${postResponse.data}');
}

Additional information

  • Package homepage: GitHub
  • Bug reports and feature requests: Issue Tracker
  • Want to contribute? Create a pull request
  • License: MIT

For more examples and detailed documentation, please visit the GitHub repository.

Libraries

api_join