Skip to content

Repository files navigation

APIManager-Flutter

pub packagecodecovlicensepr-welcomeOpen Source Love

APIManager-Flutter is an API manager for flutter applications that can manage the API calls from a single place.

Features

Here's the list of your all-in-one service

  • Manage token transaction
  • Secured token transaction
  • Basic CRUD operations
  • Upload file
  • Download file
  • Enable logging
  • Support Multi environment base url

Android Compatibility

Since this package is dependent on flutter_secure_storage a minSdkVersion of 18 is required

android > app > build.gradle

android {
...
defaultConfig {
...
minSdkVersion 18
...
}
}

Installation

To install this package, run

flutter pub add flutter_api_manager

Usage

Create a singleton and make requests

import'package:flutter_api_manager/flutter_api_manager.dart';
classAPIController {
APIManager _apiManager =APIManager.getInstance(baseUrl:'<your-base-url>');
staticfetchResults() {
_apiManager.request('endPoint', method:APIMethod.get).then((response) {
... });
}
staticuploadFile(File imageFile, String fileKey, Map data,) {
_apiManager.uploadFile('endPoint', imageFile, fileKey, data: data).then((response) {
... });
}
}

Login once to set the token throughout the app

...
staticlogin() {
String token =_getToken();
_apiManager.login(token);
}
...

Logout when you want to clear the token

...
staticlogout() {
_apiManager.logout();
}
...

Want to Contribute

Here's a way to start contributing

You are always WELCOME! We are excited to see your awesome PRs.

NOTE: Please abide by the CODE OF CONDUCT.

About

APIManager-Flutter is a flutter library that can manage the API calls from a single place.

Topics

Resources

Code of conduct

Contributing

Stars

6 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages