Skip to main content

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

A package:http client for Flutwire. It records the calls that the dart:io capture cannot see, such as every call on the web.

example/example.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutwire/flutwire.dart';
import 'package:flutwire_http/flutwire_http.dart';
import 'package:http/http.dart' as http;

Future<void> main() async {
  await Flutwire.init();
  runApp(const ExampleApp());
}

/// Wrap the client your app already uses. Chopper takes it the same way, as
/// `ChopperClient(client: client)`.
final client = FlutwireClient(http.Client());

Future<void> call() async {
  try {
    await client.get(Uri.https('jsonplaceholder.typicode.com', '/todos/1'));
  } on http.ClientException {
    // Flutwire records a failed call too, so the inspector shows what happened.
  }
}

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorKey: Flutwire.navigatorKey,
      // Floats the inspector button where there is no notification to tap.
      builder: Flutwire.builder,
      home: Scaffold(
        body: Center(
          child: FilledButton(
            onPressed: () => unawaited(call()),
            child: const Text('Call the API'),
          ),
        ),
      ),
    );
  }
}
1
likes
160
points
133
downloads

Documentation

API reference

Publisher

verified publishernacodestudios.it

Weekly Downloads

A package:http client for Flutwire. It records the calls that the dart:io capture cannot see, such as every call on the web.

Repository (GitHub)
View/report issues
Contributing

Topics

#http #networking #debugging #inspector

Funding

Consider supporting this project:

github.com

License

Apache-2.0 (license)

Dependencies

flutter, flutwire, http

More

Packages that depend on flutwire_http