eticon_api 1.3.0
eticon_api: ^1.3.0 copied to clipboard

This package will help you quickly and easily work with HTTP REQUESTS. All you need to do is select one of the 4 required requests: GET, POST, DELETE, PUT

example/lib/main.dart

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

void main() async {
  await Api.init(baseUrl: 'https://example.com/');
  bool tokenLoaded = Api.loadTokenFromMemory();
  if (tokenLoaded) {
    print(Api.token);
  }
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('ETICON API Example'),
      ),
      body: Center(
        child: GestureDetector(
          onTap: getRequest,
          child: Container(
            width: 150,
            height: 150,
            color: Colors.black,
          ),
        ),
      ),
    );
  }

  Future<void> getRequest() async {
    try {
      Map<String, dynamic> response = await Api.get(
        method: 'product',
      );
    } on APIException catch (error) {
      print('ERROR CODE: ${error.code}');
    }
  }
}
7
likes
130
pub points
65%
popularity

Publisher

eticon.ru

This package will help you quickly and easily work with HTTP REQUESTS. All you need to do is select one of the 4 required requests: GET, POST, DELETE, PUT

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, get_storage, http

More

Packages that depend on eticon_api