init method

  1. @override
Future<void> init()
override

Call this function before using Enzona APIs

Implementation

@override
Future<void> init() async {
  if(isInitialized) return;

  dioOauth2Client = await DioOauth2Client.clientCredentialsGrant(
    Uri.parse(accessTokenUrl),
    consumerKey,
    consumerSecret,
    scopes: scopes,
    httpClient: httpClient,
  );

  // dioOauth2Client = DioOauth2Client(
  //   oauth2.Credentials(
  //     '1c50c1ef-a6e4-3cb2-9be0-b227b04e88b9',
  //     scopes: scopes,
  //   ),
  //   identifier: consumerKey,
  //   secret: consumerSecret,
  //   httpClient: httpClient,
  // );

  restAPI.init(
    httpClient: httpClient,
    dioOauth2Client: dioOauth2Client,
    apiUrl: apiUrl,
    timeout: timeout,
  );

  paymentAPI = PaymentAPIRetrofit();
  _initialized = true;
}