Renovation
Search…
Getting started

Installation

To get started with Renovation, add the following under dependencies in pubspec.yaml:
1
renovation_core: ^1.0.2
Copied!
Then in the Terminal/CLI in the project's directory, run the following:

Dart (Native/Web)

1
pub get
Copied!

Flutter

1
flutter pub get
Copied!

Usage

To get started, just import the package like:
1
import 'package:renovation_core/core.dart';
Copied!
The minimum lines to be added to initialize Renovation are:
1
import 'package:renovation_core/core.dart';
2
3
void main() async {
4
final renovationInstance = Renovation();
5
await renovationInstance.init('https://backend.example.com');
6
}
Copied!
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
When using cookies for session authentication, you must specify the cookies directory. For instance:
1
await renovation.init('https://backend.example.com',
2
cookieDir: './cookies');
Copied!
If JWT is to be used and renovation_core is installed in the backend, you can enable it as follows:
1
await renovation.init('https://backend.example.com', useJWT: true);
Copied!

Libraries

Auth
1
import 'package:renovation_core/auth.dart';
Copied!
Model
1
import 'package:renovation_core/model.dart';
Copied!
Storage
1
import 'package:renovation_core/storage.dart';
Copied!
Misc
1
import 'package:renovation_core/misc.dart';
Copied!
Backend Specific
1
import 'package:renovation_core/backend.dart';
Copied!

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:
1
Unhandled exception:
2
The app "renovation_core" is not installed in the backend.
3
Please install it to be able to use the feature(s):
4
5
6
withLinkFields
7
tableFields
Copied!
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é.
Last modified 1yr ago