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

Simple package that allow you to call APIs

example/lib/main.dart

import 'dart:async';

import 'package:api_call_manager/api_call_manager.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  var _post;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      builder: EasyLoading.init(),
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Api Manager example'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text(
                'Posts:  ${_post ?? "No Data"}',
                textAlign: TextAlign.center,
              ),
              SizedBox(
                height: 20,
              ),
              ElevatedButton(
                  onPressed: () {
                    getPost();
                  },
                  child: const Text("Click Me"))
            ],
          ),
        ),
      ),
    );
  }

  Future<void> getPost() async {
    final data = await ApiManager()
        .getData(apiUrl: "https://jsonplaceholder.typicode.com/todos/1");
    setState(() => _post = data);
  }
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Simple package that allow you to call APIs

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_easyloading, http

More

Packages that depend on api_call_manager