no_code_api_connector 0.0.1
no_code_api_connector: ^0.0.1 copied to clipboard
A Flutter package to make api requests with out writing the code.
๐ฆ no_code_api_connector #
no_code_api_connector is a Flutter package that allows you to connect to REST APIs using a simple JSON-based configuration โ no backend or manual HTTP logic needed. Perfect for developers who want to set up dynamic API integrations quickly and efficiently with minimal boilerplate.
๐ Features #
- ๐ Easily connect to any REST API with a JSON config
- ๐งฉ Supports
GET,POST,PUT,DELETE, and more - ๐ Built-in support for Bearer and Basic authentication
- ๐ Handles headers, query params, and body formats
- ๐งช Developer-friendly and easy to debug
- ๐งฐ Extensible and ready for production
๐ Getting Started #
Prerequisites #
- โ Flutter SDK โฅ 3.0.0
- โ Dart โฅ 2.18.0
- โ Internet permission (required for Android/iOS)
Installation #
Add the following to your pubspec.yaml:
dependencies:
no_code_api_connector: ^0.0.1
Then run:
flutter pub get
๐ Usage #
Step 1: Import the package #
import 'package:no_code_api_connector/no_code_api_connector.dart';
Step 2: Create a JSON config #
final config = {
"baseUrl": "https://jsonplaceholder.typicode.com",
"headers": {
"Content-Type": "application/json"
},
"endpoints": {
"getPosts": {
"path": "/posts",
"method": "GET"
},
"createPost": {
"path": "/posts",
"method": "POST",
"body": {
"title": "{{title}}",
"body": "{{body}}",
"userId": "{{userId}}"
}
}
}
};
Step 3: Initialize the connector #
final connector = NoCodeApiConnector.fromJson(config);
Step 4: Call an endpoint #
// GET example
final response = await connector.call("getPosts");
if (response.statusCode == 200) {
print(response.body);
} else {
print('Error: ${response.statusCode}');
}
// POST example
final postResponse = await connector.call("createPost", variables: {
"title": "New Post",
"body": "This is the body of the new post.",
"userId": 1
});
You can find more advanced examples in the /example directory.
๐ Folder Structure #
lib/
โโโ no_code_api_connector.dart
src/
โโโ api_connector.dart
โโโ api_config.dart
โโโ auth_provider.dart
โโโ request_config.dart
โโโ response_handler.dart
example/
โโโ main.dart
๐ License #
This project is licensed under the MIT License.
๐ Contributions #
Contributions, suggestions, and feedback are always welcome!
- Fork the repository
- Create your feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
๐ฌ Contact #
For issues, reach out via the GitHub Issues page.
Made with โค๏ธ by [Dhruv Chotai]