flutter_api_manager 1.0.0 copy "flutter_api_manager: ^1.0.0" to clipboard
flutter_api_manager: ^1.0.0 copied to clipboard

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

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_api_manager/flutter_api_manager.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Response response;

  @override
  void initState() {
    super.initState();

    final _apiManager = APIManager.getInstance(baseUrl: 'https://reqres.in');
    WidgetsBinding.instance.addPostFrameCallback((_) async {
      try {
        response = await _apiManager.request('/api/users/4');
        setState(() {});
      } catch (e) {
        print(e);
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: Scaffold(
        body: Center(
          child: Text(response?.data.toString()),
        ),
      ),
    );
  }
}
3
likes
140
pub points
0%
popularity

Publisher

verified publisheriamdipanshus.in

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

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_secure_storage, http, http_parser, mime

More

Packages that depend on flutter_api_manager