http_handler 0.0.1 copy "http_handler: ^0.0.1" to clipboard
http_handler: ^0.0.1 copied to clipboard

HttpHandler provides utility functions and customization options to streamline API request handling in your Flutter applications.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'common_call/api_call.dart';

void main() {
  runApp(const MaterialApp(home: MyApp()));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key}); // Create a Http instance

  @override
  Widget build(BuildContext context) {
    final size = MediaQuery.of(context).size;
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('HttpHandler Example'),
        ),
        body: Container(
          alignment: Alignment.center,
          height: size.height,
          width: size.width,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                onPressed: () {
                  makeGetApiRequest(context);
                },
                child: const Text('Make Get API Request'),
              ),
              Container(
                color: Colors.lightBlueAccent,
                alignment: Alignment.center,
                height: size.height / 7,
                width: size.width / 2,
                child: const Text(
                  "Sample Data for post API:{'userId': 1,'id': 1,'title': 'New Post','body': 'This is a new post.',}",
                  style: TextStyle(color: Colors.white),
                ),
              ),
              ElevatedButton(
                onPressed: () {
                  makePostApiRequest(context);
                },
                child: const Text('Make Post API Request'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
10
likes
140
points
25
downloads
screenshot

Publisher

verified publisherarfaz.tech

Weekly Downloads

HttpHandler provides utility functions and customization options to streamline API request handling in your Flutter applications.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#api #api-call #http-handler #http

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

connectivity_plus, flutter, http

More

Packages that depend on http_handler