http_handler 0.0.1-beta-2 copy "http_handler: ^0.0.1-beta-2" to clipboard
http_handler: ^0.0.1-beta-2 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
0
points
25
downloads

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

License

unknown (license)

Dependencies

connectivity_plus, flutter, http

More

Packages that depend on http_handler