Flutter SDK Reference

Core

Class CredoAppService

Represents the bridge between Flutter and native SDK.

var service = CredoAppService();

Method setForceResolvePermissions()

This method is designed to manage permission behavior on iOS.

If it is determined to be true, the SDK will automatically request permissions; otherwise, the SDK will not request permissions.

service.setForceResolvePermissions(bool force)

Parameters: 

NameDescriptionType
forceIf true then SDK requests permissions automatically otherwise SDK omits requesting permissions.

The default value is true.
bool

📘

Note

Even when the value is set to false, the Music permission (NSAppleMusicUsageDescription in IosMusicModule module) will be automatically requested by the SDK when related data will be involved.

Method setIgnorePermissions()

This method is designed to manage permission behavior on Android.

  • The method sets if SDK should prevent the run of collect() if permissions aren't granted.
  • The true value allows collecting dataset even if not all permissions are granted.
  • The false value restricts collecting dataset from running until all permissions are granted (including normal permissions).
  • The default value is true
service.setIgnorePermissions(false)

Parameters: 

NameDescriptionType
ignorePermissionsThe true value allows data collection even if not all permissions are granted. The false value restricts data collection until all permissions (including normal permissions) are granted.

The default value is true.
bool

Method addModule()

The method adds a module to the CredoAppService configuration.

await service.addModule(SampleModule());

Parameters:

NameDescriptionType
moduleRepresents platform moduleAndroidApplicationModule
AndroidCalendarModule
AndroidContactModule
AndroidAccountModule
AndroidImagesModule
AndroidIovationModule
AndroidAudioModule
AndroidVideoModule
AndroidSmsModule
IosMusicModule
IosCalendarEventsModule
IosCalendarRemindersModule
IosContactsModule
IosIovationModule
IosMediaModule

Returns:

TypeDescription
FutureReturns Future

Method collect()

📘

Collects data from the phone and returns locally.

await service.collect();

Returns:

TypeDescription
FutureReturns JSON dataset in compressed string format if collect action is succeeded

Class CredoappResult

CredoAppResult states for successful operation and contains a value

Field NameTypeDescription
valueStringReturns collected data
isFailureboolReturns false if the operation is completed successfully otherwise true.
messageStringReturns message value if the operation is failed.
codeStringReturns code value if the operation is failed.

Error Codes

Status CodeReasonDescription
30Duplicated areas errorThe extracting areas are duplicated.
90Unknown errorUnexpected error occurred.
91The module is not supportedUse a higher plugin version.

Behavioral

Class CredoAppBehavioral

CredoAppBehavioral widget is responsible for capturing a user's interaction with UI and OS for both Android and iOS platforms. The app root element has to be wrapped with CredoAppBehavioral widget to track all widgets that exist on the screen.

Constructor

NameDescriptionType
keyConstruct a ValueKey with the given StringKey
startTrackingShould the tracking process be started or not. The default value is truebool
childThe widget below this widget in the treeWidget

How to use CredoAppBehavioral

import 'package:flutter_behavioral/behavioral/credoapp_behavioral.dart';

void main() {
  runApp(CredoAppBehavioral(
      key: Key("root_layout"),
      startTracking: true,
      child: const MyApp()));
}

🚧

Wrapping widgets with CredoAppBehavioral is a mandatory integration step

Class BehavioralModule

BehavioralModule is responsible for collecting behavioral events

BehavioralModule()

Static method BehavioralModule.startTracking()

Starts behavioral interaction metadata tracking

BehavioralModule.startTracking()

Static method BehavioralModule.stopTracking()

Terminates behavioral metadata tracking

BehavioralModule.stopTracking()

How to use start and stop tracking methods

If the false value has been passed for the startTracking parameter in CredoAppBehavioral widget, the tracking process must be initiated manually. To start tracking, the BehavioralModule.startTracking() method needs to be called. The example is below

import 'package:flutter_behavioral/module.dart'; 

ElevatedButton(onPressed: () => { BehavioralModule.startTracking()},
                    key: Key("go_to_loan_form_screen_btn"),
                    child: Text("Open Loan form screen"))

To stop the tracking process the BehavioralModule.stopTracking() method has to be called. The example is below

import 'package:flutter_behavioral/module.dart';

ElevatedButton(onPressed: () => { BehavioralModule.stopTracking()},
                    key: Key("submit_btn"),
                    child: Text("Submit"))

Widget identification

👍

Highly recommended

For successful integration, we strongly recommend pass value Key value to the widget constructor, to emphasize a specific logical control or element that holds significance within the User Flow of your app.

For example:

 ElevatedButton(onPressed: () => { },
                    key: Key("submit_btn"),
                    child: Text("Submit")),

📘

See more examples in our Behavioral Module Identifiers Guide (Flutter)