folivora_http 0.0.3 copy "folivora_http: ^0.0.3" to clipboard
folivora_http: ^0.0.3 copied to clipboard

A useful http package.

example/lib/main.dart

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

import 'theme_notifier.dart';

void main() {
  runApp(ThemeNotifier(child: const MyApp()));
}

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

  @override
  Widget build(BuildContext context) {
    return ValueListenableBuilder(
      valueListenable: ThemeNotifier.of(context)!.theme,
      builder: (BuildContext context, ThemeData themeData, child) {
        return MaterialApp(
          debugShowCheckedModeBanner: false,
          title: 'Folivora Package Test App',
          theme: themeData,
          home: const MyHomePage(title: 'Folivora'),
        );
      },
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: ElevatedButton(
          onPressed: () async {
            final FvHttp yourHttp =
                FvHttpGenerator.config(scheme: "https", host: 'api.agify.io');
            final FvHttp yourHttp2 = FvHttpGenerator.config(
                scheme: "https",
                host: 'api.agify.io',
                jsonDecodingOption: JsonDecodingOption.noOption);
            final FvHttp yourHttp3 = FvHttpGenerator.config(
                scheme: "https",
                host: 'api.agify.io',
                jsonDecodingOption: JsonDecodingOption.utf8);
            final FvHttp yourHttp4 =
                FvHttpGenerator.config(scheme: "https", host: 'httpbin.org');

            await yourHttp.client
                .get(path: '', queryParameters: {"name": "dhkim"});
            await yourHttp2.client.external(
                uriAddress: 'https://api.agify.io?name=dhkim', method: "GET");
            await yourHttp3.client.external(
                uriAddress: 'https://api.agify.io?name=dhkim', method: "GET");
            await yourHttp4.client.get(path: 'get');
            await yourHttp4.client.post(path: 'post', body: {});
            await yourHttp4.client.put(path: 'put', body: {});
            await yourHttp4.client.delete(path: 'delete', body: {});
            await yourHttp4.client.patch(path: 'patch', body: {});
          },
          child: const Text("Test"),
        ),
      ),
    );
  }
}
0
likes
120
points
26
downloads

Publisher

verified publisherfolivora.io

Weekly Downloads

A useful http package.

Documentation

API reference

License

MIT (license)

Dependencies

flutter, folivora_error_handler, folivora_logger, http

More

Packages that depend on folivora_http