autopilot_api 2.0.0 copy "autopilot_api: ^2.0.0" to clipboard
autopilot_api: ^2.0.0 copied to clipboard

Zero dependency pure Dart API engine for Flutter with smart caching, retry, token refresh, multipart upload, download support and automatic parsing.

πŸš€ AutoPilot API Zero-boilerplate smart API engine for Flutter β€” now Pure Dart ⚑

Pure Dart β€’ Zero Dependencies β€’ No Dio β€’ No http β€’ No shared_preferences β€’ Production Ready

🎯 Why AutoPilot?

Every Flutter project eventually faces the same problem:

repeated API boilerplate manual token handling retry logic everywhere duplicated error handling complex multipart uploads cache management headaches

AutoPilot solves all of this with a clean, beginner-friendly, production-ready API engine.

⚑ Why AutoPilot Is Different

Most API packages:

require heavy setup depend on multiple plugins force repository patterns need manual retry/cache/token handling become difficult for beginners

AutoPilot provides everything out of the box.

βœ… Zero dependencies βœ… Pure Dart networking βœ… Automatic token injection βœ… Built-in retry system βœ… Smart caching βœ… Multipart uploads βœ… Auto parsing βœ… Request deduplication βœ… Production-ready architecture

❌ Traditional API Code Future<UserModel?> getUser() async { try { final request = await HttpClient() .getUrl(Uri.parse('$baseUrl/user'));

final response = await request.close();

if (response.statusCode == 200) {
  final body = await response
      .transform(utf8.decoder)
      .join();

  final json = jsonDecode(body);

  return UserModel.fromJson(json['data']);
}

} catch (e) { rethrow; }

return null; } βœ… AutoPilot Way final res = await api.get

if (res.isSuccess) { print(res.data); } else { print(res.message); } ✨ Features Feature Supported πŸš€ GET, POST, PUT, PATCH, DELETE βœ… πŸ“ Multipart upload βœ… ⬇️ File download βœ… πŸ” Auto token injection βœ… πŸ”„ Auto token refresh βœ… πŸ’Ύ Smart memory cache βœ… ⚑ Request deduplication βœ… πŸ” Retry with exponential backoff βœ… 🌐 Internet connectivity check βœ… πŸ“¦ Smart response parsing βœ… 🎨 Beautiful debug logs βœ… 🌍 Runtime environment switching βœ… πŸ”Œ GetX / Bloc / Riverpod / Provider βœ… πŸ§ͺ Unit-test friendly βœ… ⚑ Zero dependencies βœ… πŸ”₯ What's New in v2.0.0

AutoPilot is now built entirely using Dart SDK libraries.

No external networking package required.

❌ Removed External Packages Removed Package Replaced With http dart:io HttpClient shared_preferences Pure Dart local storage connectivity_plus Native socket lookup path Internal utilities mime Internal MIME resolver ⚑ Zero Dependencies dependencies: autopilot_api: ^2.0.0

That’s it.

No dependency conflicts. No platform channels. No native setup. No plugin headaches.

πŸ“¦ Installation

Add this to your pubspec.yaml:

dependencies: autopilot_api: ^2.0.0

Then run:

flutter pub get πŸš€ 60-Second Integration Step 1 β€” Initialize AutoPilot void main() async { WidgetsFlutterBinding.ensureInitialized();

await AutoPilotApi.init( baseUrl : 'https://api.example.com/v1', enableLogs : true, enableCache : true, );

runApp(const MyApp()); } Step 2 β€” Make Your First API Call final api = AutoPilotApi.instance;

final res = await api.get

if (res.isSuccess) { print(res.data); } else { print(res.message); }

That’s enough to start using AutoPilot in any Flutter project.

πŸ“š Complete Beginner Flow Step 1 β€” Create Model class UserModel { final int id; final String name;

UserModel({ required this.id, required this.name, });

factory UserModel.fromJson(Map<String, dynamic> json) { return UserModel( id : json['id'], name : json['name'], ); } } Step 2 β€” Call API final res = await api.get

AutoPilot uses:

import 'dart:io';

Powered internally by:

HttpClient

No http package required.

πŸ” Token Management Save Access Token await AutoPilotApi.setToken(token); Save Access + Refresh Tokens await AutoPilotApi.setTokens( accessToken : accessToken, refreshToken : refreshToken, ); Logout await AutoPilotApi.clearTokens();

Tokens are stored using:

⚑ In-memory cache πŸ’Ύ Pure Dart local storage πŸ”„ Auto Token Refresh await AutoPilotApi.init( enableTokenRefresh : true,

onRefreshToken : () async { final token = await refreshAuthToken(); return token; }, ); Refresh Flow Request ↓ 401 Unauthorized ↓ Refresh Token ↓ Retry Original Request ↓ Success βœ… πŸ’Ύ Smart Cache final res = await api.get( endpoint : '/config', useCache : true, cacheDuration : Duration(hours: 1), );

Supports:

⚑ Memory cache πŸ’½ Persistent disk cache 🧠 Automatic invalidation πŸ”‘ Smart cache keys πŸ“ Multipart Upload final res = await api.multipart( endpoint : '/upload',

files : [ MultipartFileModel( key : 'image', path : file.path, ), ], );

Supports:

Single file upload Multiple files Videos PDFs Form-data fields Custom MIME types ⬇️ File Download final res = await api.download( endpoint : '/invoice.pdf', savePath : '/storage/downloads/invoice.pdf',

onProgress : (received, total) { final progress = received / total; print(progress); }, ); ⚑ Request Deduplication await Future.wait([ api.get(endpoint: '/user'), api.get(endpoint: '/user'), api.get(endpoint: '/user'), ]);

βœ… Only ONE request hits the server.

All callers receive the same response.

πŸ” Retry System await AutoPilotApi.init( maxRetries : 3, retryDelay : Duration(seconds: 1), ); Retry Flow Attempt 1 β†’ Fail Attempt 2 β†’ Fail Attempt 3 β†’ Success βœ…

Retries automatically on:

SocketException TimeoutException Temporary connection failures 🎨 Beautiful Debug Logs β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ πŸš€ REQUEST [REQ-9A1F] β”‚ GET https://api.example.com/user └─────────────────────────────────────────────

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ βœ… RESPONSE [REQ-9A1F] β”‚ Status: 200 β”‚ Time: 221ms └───────────────────────────────────────────── πŸ“¦ ApiResponse

Every request returns a strongly typed response object:

ApiResponse

βœ… GetX βœ… Bloc βœ… Cubit βœ… Riverpod βœ… Provider βœ… MobX βœ… Vanilla setState

No adapters or wrappers required.

🌍 Runtime Environment Switching api.reconfigure( (config) => config.copyWith( baseUrl: 'https://staging.api.com', ), );

Perfect for:

staging production testing QA environments πŸ§ͺ Unit Testing Friendly flutter test

Supports:

Mock clients Fake responses Offline testing Parser testing πŸ“ Performance Optimized ⚑ Fast because: Persistent HttpClient In-memory token cache Request deduplication Smart retries Minimal allocations Zero reflection No platform channels πŸ›‘ Built-in Exceptions ApiException NetworkException TimeoutApiException UnauthorizedException ValidationException ServerException CacheException πŸ“‹ API Reference Method Description get() GET request post() POST request put() PUT request patch() PATCH request delete() DELETE request multipart() Upload files download() Download files clearCache() Clear all cache invalidateCache() Remove endpoint cache setToken() Save access token clearTokens() Logout reconfigure() Runtime config update πŸ”₯ Perfect For Flutter beginners Production apps MVPs Admin panels E-commerce apps REST APIs Clean architecture projects GetX / Riverpod / Bloc apps ⚑ Performance Comparison Feature Traditional APIs AutoPilot Boilerplate High Very Low Dependencies Multiple Zero Retry Manual Built-in Token Refresh Manual Automatic Cache Manual Built-in Multipart Upload Complex Simple Setup Time Long Minutes 🎯 Why Developers Love AutoPilot

βœ… Minimal boilerplate βœ… Faster development βœ… Production-ready architecture βœ… Beginner-friendly API βœ… Zero dependency conflicts βœ… Smaller APK size βœ… Faster compile times βœ… Pure Dart performance

πŸ“„ License

MIT License Β© 2026 AutoPilot API

Made with ❀️ for Flutter developers

⭐ Star on GitHub β€’ πŸ“¦ Publish on pub.dev β€’ πŸš€ Build faster with AutoPilot

3
likes
140
points
200
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Zero dependency pure Dart API engine for Flutter with smart caching, retry, token refresh, multipart upload, download support and automatic parsing.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on autopilot_api