http_base_helper 0.0.4 copy "http_base_helper: ^0.0.4" to clipboard
http_base_helper: ^0.0.4 copied to clipboard

To make easy for using http request API

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  final httpBaseHelper = ApiBaseHelper();

  Future<void> onFetchAlbums() async {
    debugPrint("is event calendar workig1");

    await httpBaseHelper
        .onNetworkRequesting(
          methode: METHODE.get,
          isAuthorize: false,
          fullURL: 'https://jsonplaceholder.typicode.com/albums',
        )
        .then((response) => {debugPrint("Albums:$response")})
        .onError((ErrorModel error, stackTrace) =>
            {debugPrint("is event calendar workig2${error.bodyString}")});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: const <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          onFetchAlbums();
        },
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
2
likes
135
points
37
downloads

Publisher

unverified uploader

Weekly Downloads

To make easy for using http request API

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter, get

More

Packages that depend on http_base_helper