webservice 0.0.5 copy "webservice: ^0.0.5" to clipboard
webservice: ^0.0.5 copied to clipboard

A powerful Http client for Dart, which handles requests. Super easy to use and much more comming soon. Wait for our updates.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'WebService',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

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

class _MyHomePageState extends State<MyHomePage> {

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

  getData(){
    WebService().get(url: "https://dummyjson.com/products", onResponse: (response){
      if(response.statusCode==200){
        //print response Data
        print(response.data);
      }else{
        //print error message on fail
        print(response.message);
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return const Scaffold();
  }
}
10
likes
130
pub points
64%
popularity

Publisher

unverified uploader

A powerful Http client for Dart, which handles requests. Super easy to use and much more comming soon. Wait for our updates.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dio, flutter

More

Packages that depend on webservice