httpservice 1.0.2 copy "httpservice: ^1.0.2" to clipboard
httpservice: ^1.0.2 copied to clipboard

A project that contains helper classes to help with http package.(only get is supported for now)

example/lib/main.dart

import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:httpservice/httpservice.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Http Service example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    super.initState();
    getapidata("https://www.reddit.com/.json");
  }

  void getapidata(String apix) async {
    HttpService httpService = HttpService("$apix");
    var data = await httpService.getContents();
    var decodedData = jsonDecode(data);
    print(decodedData);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold();
  }
}
2
likes
120
pub points
23%
popularity

Publisher

unverified uploader

A project that contains helper classes to help with http package.(only get is supported for now)

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, http

More

Packages that depend on httpservice