Sdk Integration

Flutter.dev

Configure project

To use the Netsocks SDK in Flutter, it is necessary to declare the SDK inside the dependencies block of the pubspec.yaml file of your app:

dependencies:
  netsocks: ^1.0.0-rc05

Then, you have to run the following command to install the SDK in your project:

$ flutter pub get

That's all. You can now use import to access the SDK functionalities:

import 'package:netsocks/netsocks.dart';

Configure Manifest with the necessary permissions

Our SDK does not collect any personal information from your users, so no special permission is needed for our SDK to work, so you only need to add the internet permission.

To do so, you have to add the following line in the android/app/src/main/AndroidManifest.xml file inside the <manifest..>.. block

<uses-permission android:name="android.permission.INTERNET"/>

It is possible that you have already added this permission before, in case you already have it, it is not necessary to add it again.


In some countries, it is necessary to obtain the user's consent in order to obtain revenues with their Internet connection. You can implement your own consent screen for this purpose and call the SDK's activation or deactivation methods depending on the user's response.


Initialize/activate SDK

Remember that your PUBLISHER-KEY is located in the Netsocks portal. To view it click on 'Add new application'. Or check the Publisher Key section.

To initialize and/or activate the SDK, you need to add the following code inside the initState() method of your application:

await Netsocks.enable('PUBLISHER-KEY');

Applications will be automatically added to your portal when the SDK is integrated and activated for the first time, this is thanks to our 1 STEP INTEGRATION technology, so you can focus on what really matters 🥰.


Deactivate SDK

In order to disable the SDK, you can call the following method.

await Netsocks.disable();

It is correct to call this function if in your consent implementation, the user rejected your request. This function permanently disables the SDK until you call the activation method again.

Last updated