Skip to main content
Version: 4.6.1-saas

Installation and Initialization

This guide explains the installation and initialization process for the NetFUNNEL Flutter agent.


Step 1: Package Installation

Adding Dependencies

The NetFUNNEL Flutter agent is provided as a tar.gz package file. It is not available through public repositories (pub.dev), so you must add the provided archive file directly to your project.

After copying the tar.gz file to the project root or your desired location, add the dependency to pubspec.yaml:

dependencies:
netfunnel_flutter:
path: ./netfunnel_flutter-{{latest}} # Path where tar.gz file is copied
Indentation Caution

The pubspec.yaml file recognizes hierarchical structure based on indentation, so be careful with indentation.

Installing the Package

Run the following command from the project root directory:

flutter pub get

Step 2: Network Permission Configuration

Android

For Android, you need to add internet usage permission to communicate with the NetFUNNEL server.

Add the following permission to the android/app/src/main/AndroidManifest.xml file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- Internet permission configuration -->
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

iOS

iOS has internet permission enabled by default. No additional configuration is required.


Step 3: Getting Client ID

  1. Go to the NetFUNNEL console
  2. Click the profile icon in the top right
  3. Select the Integration Credentials menu
  4. Copy the Client ID
Client ID Location

You can find it in the Integration Credentials menu after clicking the profile icon in the top right of the console screen.


Step 4: Agent Initialization

The NetFUNNEL Flutter agent must be initialized when the app starts.

Perform the initialization in the main() function of main.dart:

import 'package:netfunnel_flutter/netfunnel_flutter.dart';

void main() async {
// NetFUNNEL agent initialization
await Netfunnel.instance.initialize(
clientId: '{{CLIENT_ID}}', // Client ID obtained in Step 3
serverUrl: '{{SERVER_URL}}', // Optional
errorUrl: '{{ERROR_URL}}', // Optional
networkTimeout: 3000,
retryCount: 0,
printLog: false,
errorBypass: false,
useNetfunnelTemplate: true,
userId: '{{USER_ID}}', // Optional
useNetworkRecoveryMode: true,
profile: 'prod_tokyo',
);
runApp(MyApp());
}

Initialization Parameters

ParameterTypeDescriptionConditions
clientIdStringUser unique identifierCannot be empty string
serverUrlStringNetFUNNEL server addressNone (uses default address)
errorUrlStringHTML address of NetFUNNEL error pageNone (uses default address)
networkTimeoutintMaximum time to wait for network responseDefault (ms): 3,000
Maximum (ms): 10,000
Minimum (ms): 100
retryCountintNumber of retries on network request failureDefault (times): 0
Maximum (times): 10
Minimum (times): 0
printLogboolWhether to output logs for debuggingDefault: false
errorBypassboolWhether to bypass on errorDefault: false
useNetfunnelTemplateboolWhether to use NetFUNNEL waiting room customized in consoleDefault: true
userIdStringUnique identifier of end-user for blacklist and whitelist checkingDefault: null
useNetworkRecoveryModeboolWhether to use feature that maintains waiting room and attempts reconnection when network connection is lostDefault: false
profileStringUser environment configuration (prod_tokyo, prod_us_east)Default: prod_tokyo
Initialization Settings Details

For detailed information on all initialization parameters, refer to the Initialization Options documentation.


Step 5: Installation Verification

To verify that the agent is installed correctly, check the following:

  1. Initialization Success: No errors should occur when the app starts
  2. Log Verification: If printLog: true is set, you can check logs with the [NF4] prefix in the Flutter console

Troubleshooting

Package Installation Failure:

  • Check network connection
  • Verify dependency path in pubspec.yaml
  • Verify that the tar.gz file is in the correct location

Initialization Failure:

  • Verify that clientId is set correctly
  • Verify that it is not an empty string

Next Steps