http_io 1.3.0 copy "http_io: ^1.3.0" to clipboard
http_io: ^1.3.0 copied to clipboard

A composable, Future-based library for making HTTP requests with multipart.

example/lib/main.dart

import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:http_io/http.dart' as http;
import 'package:http_io/response.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String status = "pending";

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('http_io'),
        ),
        body: Center(
          child: Text('Status: $status'),
        ),
      ),
    );
  }

  _apiCall() async {
    Response res = await http.get("https://www.google.com");
    if (res.statusCode == 200) {
      log("success");
      setState(() {
        status = "success";
      });
    } else {
      log("fail");
      setState(() {
        status = "fail";
      });
    }
  }
}
8
likes
160
points
45
downloads

Publisher

verified publisherdatadirr.com

Weekly Downloads

A composable, Future-based library for making HTTP requests with multipart.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_web_plugins, http, http_parser, plugin_platform_interface

More

Packages that depend on http_io