Skip to content
Retrolite is a Restful API client with a simple API syntax, without reflection.
Dart
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea/libraries
example
lib
test
.gitignore
BACKLOG.md
CHANGELOG.md
LICENSE
README.md
analysis_options.yaml
pubspec.yaml

README.md

retrolite

retrolite is a RESTful API client for Dart and Flutter, with a simple API syntax, without reflection.

This package uses the abstraction classes from flutuate_api, used to create RESTful api clients.

Configuration

Add retrolite to pubspec.yaml under the dependencies field.

dependencies:
  retrolite: ^latest_version

Import

Add the following import in your library :

import 'package:retrolite/retrolite.dart';

Example

Below, a simple provider sample to REQ|RES API:

/// [REQ|RES](https://reqres.in) API provider 
class ReqResApi extends IApi {
  /// Get the users list.
  Future<Response<ListUsers>> listUsers(int page) => 
    client.get<ListUsers>(
      'api/users?page=$page',
      contentType: ContentType.json,
      deserializer: ListUsers.deserialize,
    );

  /// Request the users list with delay.
  Future<Response<ListUsers>> listUsersWithDelay(int delay) => 
    client.get<ListUsers>(
      'api/users',
      queryParameters: {
        'delay': delay
      },
      contentType: ContentType.json,
      deserializer: ListUsers.deserialize,
    );

  /// Request the register service with success.
  Future<Response<RegisterResult>> register(RegisterContent content) => 
    client.post<RegisterResult>(
      'api/register',
      deserializer: RegisterResult.deserialize,
      contentType: ContentType.json,
      body: content
    );
}

Usage

The sample project has more details about how to use the Retrolite package.

Features and bugs

Please file feature requests and bugs at the issue tracker.

You can’t perform that action at this time.