eticon_api 1.0.2+1-beta copy "eticon_api: ^1.0.2+1-beta" to clipboard
eticon_api: ^1.0.2+1-beta copied to clipboard

outdated

This package will help you quickly and easily work with the REST API. All you need to do is select one of the 4 required requests: GET, POST, DELET, PUT. Test Mode will help you track the performance [...]

example/lib/main.dart

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

void main() async {
  bool tokenLoaded = await Api.loadTokenFromMemory();
  if (tokenLoaded) {
    print(Api.token);
  }
  Api.setBaseUrl('https://example.com/');
  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}');
    }
  }
}
12
likes
0
points
160
downloads

Publisher

verified publishereticon.ru

Weekly Downloads

This package will help you quickly and easily work with the REST API. All you need to do is select one of the 4 required requests: GET, POST, DELET, PUT. Test Mode will help you track the performance of requests during development. An autosave token will avoid repeated authorizations.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http, shared_preferences

More

Packages that depend on eticon_api