Troubleshooting
Common issues, solutions, and frequently asked questions for NetFUNNEL Flutter Agent integration.
Installation Issues
Package Installation Failure
Symptoms:
flutter pub getfails- Package not found
Solutions:
- Check network connection: Verify internet connection status
- Check package path: Verify that the dependency path in
pubspec.yamlis correct - Check tar.gz file: Verify that the tar.gz file is in the correct location
- Check indentation: Verify that the indentation in the
pubspec.yamlfile is correct
Initialization Failure
Symptoms:
- Error occurs when app starts
- NetFUNNEL is not initialized
Solutions:
- Check clientId: Verify that
clientIdis set correctly - Check empty string: Verify that
clientIdis not an empty string - Initialization location: Verify that initialization is done at the start of the
main()function inmain.dart - Check async/await: Verify that the
main()function is declared asasyncand usesawait
Function Call Errors
"nfStart is not a function" Error
Symptoms:
NoSuchMethodError: The method 'nfStart' was called on null- Function is undefined when called
Solutions:
- Check initialization: Verify that
Netfunnel.instance.initialize()was called first - Check import: Verify that
import 'package:netfunnel_flutter/netfunnel_flutter.dart'is correct - Function usage: Verify that it is called in the format
Netfunnel.instance.nfStart()
Callback Not Executing
Symptoms:
nfStartis called but callback is not executed- No response received
Solutions:
- Check network: Verify network requests to NetFUNNEL server
- Console logs: Set
printLog: trueto check debugging logs - Segment status: Verify that the segment is not in Block status
- Entry allowance: Verify that entry allowance allows entry
Network and Connection Issues
Network Timeout Error
Symptoms:
onNetworkErrorstatus code 1002- Request times out
Solutions:
- Increase timeout: Set
networkTimeoutto a higher value (max 10000ms) - Configure retry: Increase
retryCount - Network recovery: Enable
useNetworkRecoveryMode: true
await Netfunnel.instance.initialize(
clientId: 'your-client-id',
networkTimeout: 5000,
retryCount: 2,
useNetworkRecoveryMode: true,
);
Network Connection Error
Symptoms:
onNetworkErrorstatus code 1001- No internet connection
Solutions:
- Check connection: Verify internet connection status
- Firewall: Verify that NetFUNNEL domain is not blocked
- Proxy settings: Configure proxy if necessary
- Error handling: Implement appropriate NetworkError handling
class NetfunnelHandler extends NetfunnelCallback {
@override
void onNetworkError(int statusCode, String message) {
// Display user-friendly message
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text('Network Connection Issue'),
content: Text('Please check your internet connection.'),
),
);
// Optionally retry or continue
}
}
HTTP Communication Error
Symptoms:
- Error occurs during HTTP communication
- HTTPS communication works normally
Solutions:
The NetFUNNEL Flutter agent recommends HTTPS communication by default. When using HTTP communication, you can allow HTTP communication through platform-specific settings.
Android:
Create android/app/src/main/res/xml/network_security_config.xml file:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">{{DOMAIN_URL}}</domain>
</domain-config>
</network-security-config>
Add configuration to android/app/src/main/AndroidManifest.xml:
<application
android:networkSecurityConfig="@xml/network_security_config"
... >
</application>
iOS:
Add configuration to ios/Runner/Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Waiting Room Issues
Waiting Room Not Displayed
Symptoms:
- Waiting room does not appear
- User proceeds directly
Solutions:
- Entry allowance: Set to 0 for testing
- Segment activation: Verify that the segment is activated
- Template settings: Verify
useNetfunnelTemplate: true - Callback implementation: Verify that required callback functions (
onSuccess,onError,onNetworkError) are implemented
Waiting Room Stuck (Does Not End)
Symptoms:
- Waiting room appears but entry is not allowed
- Infinite waiting
Solutions:
- Entry allowance: Increase entry allowance value
- Segment status: Verify that the segment is in Block status
- Network issues: Verify network connection status
- Server status: Verify NetFUNNEL server status
Key Management Issues
Key Not Returned
Symptoms:
- Next user waits indefinitely
- Queue does not progress
Solutions:
- nfStop call: Always verify that
nfStop/nfStopSectionis called - Error handling: Return key even in error scenarios
- Check timeout: Verify segment timeout settings
try {
await performAction();
await Netfunnel.instance.nfStop(
projectKey: projectKey,
segmentKey: segmentKey,
);
} catch (error) {
print('Operation failed: $error');
// Return key even on error
await Netfunnel.instance.nfStop(
projectKey: projectKey,
segmentKey: segmentKey,
);
}
Debugging Tips
Check Logs
You can check logs by setting printLog: true for debugging:
await Netfunnel.instance.initialize(
clientId: 'your-client-id',
printLog: true, // Enable debugging logs
);
Check logs with [NF4] prefix in Flutter console.
Check Agent Version
You can use the getVersion() function to check the agent's version:
String version = Netfunnel.instance.getVersion();
print('NetFUNNEL Agent version: $version');
Common Checkpoints
- Check initialization: Verify that
Netfunnel.instance.initialize()is called correctly - Callback implementation: Verify that required callback functions (
onSuccess,onError,onNetworkError) are implemented - Key matching: Verify that the same keys are used in start and stop functions
- BuildContext: Verify that a valid
BuildContextis passed when callingnfStart/nfStartSection
Related Documentation
- Installation and Initialization: Detailed setup guide
- API Reference: Complete function specifications
- Initialization Options: All initialization parameters
- FAQ: Frequently asked questions