Getting started

Installation

To get started with Renovation, add the following under dependencies in pubspec.yaml:

renovation_core: ^1.0.2

Then in the Terminal/CLI in the project's directory, run the following:

Dart (Native/Web)

pub get

Flutter

flutter pub get

Usage

To get started, just import the package like:

import 'package:renovation_core/core.dart';

The minimum lines to be added to initialize Renovation are:

import 'package:renovation_core/core.dart';
โ€‹
void main() async {
final renovationInstance = Renovation();
await renovationInstance.init('https://backend.example.com');
}

Renovation is instantiated as a singleton, so from any where in your app, as long as Renovation is initialized once, you can access it usingRenovation().

More Required Params

In addition to the hostURL being a required param, either of the below is required when initializing:

  • cookieDir (string)

  • useJWT (bool)

cookieDir
useJWT
cookieDir

When using cookies for session authentication, you must specify the cookies directory. For instance:

await renovation.init('https://backend.example.com',
cookieDir: './cookies');
useJWT

If JWT is to be used and renovation_core is installed in the backend, you can enable it as follows:

await renovation.init('https://backend.example.com', useJWT: true);

Libraries

Auth

import 'package:renovation_core/auth.dart';

Model

import 'package:renovation_core/model.dart';

Storage

import 'package:renovation_core/storage.dart';

Misc

import 'package:renovation_core/misc.dart';

Backend Specific

import 'package:renovation_core/backend.dart';

Things to Know

RequestResponse

Across the SDK, functions will almost always return a RequestResponse object as a Future. The structure of the class is explained below.

Properties

property

type

httpCode

int

success

bool

data

T (Generics)

exc

RenovationError

error

ErrorDetail

rawResponse

Response<String> (Dio's Response)

Unless mentioned, all returns from the methods are enclosed within <Future<RequestResponse<T>> where T is a the return type. If the Output is not as <Future<RequestResponse<T>>>, the Output will be marked with an asterisk (*) which means the stated Output is the actual return type.

For example, String

String

This mean that the return is actually <Future<RequestResponse<String>>>

Featured Methods

There are some methods that are either completely or partially dependent on a custom frappe app (renovation_core). When using a method/feature that requires a custom app, an error will be thrown in case the app is not installed in your site. For example:

Unhandled exception:
The app "renovation_core" is not installed in the backend.
Please install it to be able to use the feature(s):
โ€‹
โ€‹
withLinkFields
tableFields

Throughout the guide, there will be indications when a method is completely or partially dependent on a custom frappe app.

Completely dependent: โ˜…

Partially dependent: โ˜†

By default, if there are no indications, it means the method is independent of a custom frappe app.In other words, it supports Vanilla Frappรฉ.