Library for accessing the AVI API.

For more information regarding AVI and its services, visit aviapp.mx

Initializing the library

Avi avi = Avi(context);
    // API Key
    // Secret
    // Sandbox flag
    // Google API key for Google Maps and Google Places (must be included in the Android manifest)

Once the library is initialized you can recover the Avi abject by the static shared property.

Avi avi = Avi.shared;

Checking for an existing session

Avi.shared.getSession().then((aviUser) {    
    if(aviUser != null)
        // A session exists
        // No session

Login a user

Create the AviUser object with the user credentials

AviUser aviUser = AviUser();
aviUser.name = "Alex";
aviUser.lastName = "Del Piero";
aviUser.email = "alex@delpiero.com";
aviUser.telephone = "1234567890";

Pass that AviUser object to the login method

Avi.shared.login(aviUser).then((aviUser) {
  if (aviUser != null)
    // Login successful

Logout current user

Avi.shared.logout().then((ok) {
  if (ok)
    // Logout successful

Show the AVI widget

The AVI widget handles the request of services, cancellations of services and tracking of running services (A user must be logged in).