This document help users install and implement Flutter SDK into their application. Using the Flutter framework, users can write an application for several platforms with the same codebase. The same tools and APIs that native programs utilize are also used by Flutter apps, which are created in the Dart programming language. The packages and command-line tools required to create cross-platform Flutter apps are included in the Sensfrx Flutter SDK. It gathers network data, social metrics, and fingerprint data from the device. 

Every time someone requests a new integration, develpoers won't have to stress about learning, testing, implementing, or managing modifications to a new API and several endpoints when you use the Sensfrx Flutter SDK.  


Prerequistes: 

  • Dart 2.12 or higher 

  • Flutter 1.20 or higher 

  • iOS 11+ 

  • Android API level 21+ 

Integration Steps 

  • Installing the Device Intelligence SDK with mobile application is the first step.  

  • Start the SDK so that we may collect device and user information. After that, Sensfrx will carefully review and improve the background data that was gathered. 

  • After that, users can use our API to get insights that will help them decide what to do next for their user—that is, whether to allow, block, or reroute them.  

Installation Steps: 

To install the Sensfrx Flutter SDK, follow these simple steps: 

  • Open your project's pubspec.yaml file. 

  • Add the following dependency under the dependencies section: 

    dependencies:  
    sensFRX_flutter_sdk: ^1.0.0 

Note- Make sure to replace ^1.0.0 with the latest version of the Sensfrx Flutter SDK. 

  • Save the pubspec.yaml file. 

  • Run the following command in your terminal: flutter pub get 

  • This command will fetch and download the Sensfrx Flutter SDK package into your project. 

  • Import the Sensfrx Flutter SDK in your Dart code: 

 import 'package:sensFRX_flutter_sdk/sensFRX_flutter_sdk.dart'

The workflow configuration will determine how the SDK flow is implemented. Since the workflow run ID is provided into the SDK initialization, any steps you explicitly define in the SDK integration will be overridden. 

Congratulations, Sensfrx Flutter SDK is successfully installed and ready for use. 

Note: Ensure that your Flutter SDK is up to date and compatible with the Sensfrx Flutter SDK version you are installing.  

Implementation


To implement Sensfrx SDK in the main.dart file, use the following code: 

@override 
void initState() { 
 initPlatformState(); 
 if (Platform.isAndroid) { 
   SensFRXFlutter.configure( 
       "your android secret key"); 
 } else if (Platform.isIOS) { 
   SensFRXFlutter 
       .configure(" your iOS secret key "); 
 } 
 super.initState(); 
} 

Request Token:  

To fetch the request token for login, use the following method: 

SensFRXFlutter.getRequestTokenForLogin()

Event Monitoring: 

1. Application Event 

Sensfrx manage application event itself. In case the app event is not getting generated, follow the below method. 

SensFRXFlutter .trackAppEvent(appstate)

2. Screen Change Event 

To track screen change events, add the following line to the code: 

navigatorObservers: [SensFRXFlutter.trackScreenChangeEvent()], 

Example:  

class MyApp extends StatelessWidget { 
 const MyApp({super.key}); 

 @override 
 Widget build(BuildContext context) { 
   return MaterialApp( 
     title: 'Flutter Demo', 
     theme: ThemeData( 
       primarySwatch: Colors.blue, 
     ), 
     navigatorObservers: [SensFRXFlutter.trackScreenChangeEvent()], 
     home: const MainScreen(), 
     routes: { 
       'main': (context) => const MainScreen(), 
       'login': (context) => const LoginScreen(), 
       'register': (context) => const RegisterScreen(), 
       'location': (context) => const LocationPage(), 
       'click_event': (context) => const ClickEventTestPage(), 
       'screen_one': (context) => const ScreenOne(), 
       'screen_two': (context) => const ScreenTwo(), 
       'screen_three': (context) => const ScreenThree(), 
       'screen_four': (context) => const ScreenFour(), 
     }, 
   ); 
 } 
} 

OR 

If the project doesn’t support navigatorObservers then below custom method can be used.  

SensFRXFlutter.trackScreenChangeEvent(currentScreenName)

3. Click Event 

To track click events, use the following method: 

SensFRXFlutter.trackClickEvent(context,position); 

Example: 

import 'package:sensFRX_flutter/sensFRX_flutter.dart'; 
import 'package:flutter/material.dart'; 

class ClickEventTestPage extends StatefulWidget { 
 const ClickEventTestPage({Key? key}) : super(key: key); 
 
 @override 
 State<ClickEventTestPage> createState() => _ClickEventTestPageState(); 
} 

class _ClickEventTestPageState extends State<ClickEventTestPage> { 

 @override 
 Widget build(BuildContext context) { 
   return GestureDetector( 
     onTapDown: (position) { 
       setState(() { 
         SensFRXFlutter.trackClickEvent(context,position); 
       }); 
     }, 

child: Scaffold( 
 appBar: AppBar( 
   title: const Text('Click Event Test Page'), 
 ), 
 body: Padding( 
   padding: const EdgeInsets.all(16.0), 
   child: SingleChildScrollView( 
     child: Column( 
       crossAxisAlignment: CrossAxisAlignment.stretch, 
       children: [ 
         const SizedBox(height: 16.0), 
         const Text( 
           'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 
           style: TextStyle(fontSize: 18.0), 
         ), 
         const SizedBox(height: 32.0), 
         ElevatedButton( 
           onPressed: () {}, 
           child: const Text('Button 1'), 
         ), 
         const SizedBox(height: 16.0), 
         ElevatedButton( 
           onPressed: () {}, 
           child: const Text('Button 2'), 
         )] 
        ); 
  } 
} 


For any support or assistance, please reach out to our support team at info@sensfrx.com

On this page