Code-based Integration - Basic Control
Control entry rate by calling NetFUNNEL functions in Flutter application code.
Basic control is one of two control types available in code-based integration. To compare with section control and choose the most suitable approach for your use case, refer to the Integration Methods Overview.
For detailed information about how basic control works, optimal use cases, use cases, etc., refer to the "Code-based Integration - Basic Control" section in the Common Guide document.
Prerequisites
- Installation and Initialization completed
- NetFUNNEL console access
- Flutter development environment
Create Segment
- Go to NetFUNNEL Console →
Projects→Segment - Click the
+button to create a new segment - Select Basic Control and click
Next - Enter segment name and complete setup
For detailed information about creating segments, refer to the Basic Control Segment document.
Start Function
Function Name: nfStart
Description: Call the function at the point where you want to apply waiting to issue a key and display the waiting room.
Parameters:
| Parameter | Type | Description |
|---|---|---|
projectKey | String | Basic control project key from console |
segmentKey | String | Basic control segment key from console |
callback | NetfunnelCallback | Custom callback function for waiting room event handling |
context | BuildContext | BuildContext of the screen where the waiting room is applied |
Example:
import 'package:netfunnel_flutter/netfunnel_flutter.dart';
import 'package:flutter/material.dart';
class NetfunnelHandler extends NetfunnelCallback {
@override
void onSuccess(int statusCode, String message) {
// Logic to handle when queue is passed
}
@override
void onError(int statusCode, String message) {
// Logic to handle when error occurs
}
@override
void onNetworkError(int statusCode, String message) {
// Logic to handle when network error occurs
}
@override
void onBlock(int statusCode, String message) {
// Logic to handle when user entry is blocked
}
@override
void onClose(int statusCode, String message) {
// Logic to handle when user cancels waiting
}
}
void handleButtonPress(BuildContext context) {
Netfunnel.instance.nfStart(
projectKey: '{{PROJECT_KEY}}',
segmentKey: '{{SEGMENT_KEY}}',
callback: NetfunnelHandler(),
context: context,
);
}
For how to implement callback functions, refer to the Callback Functions section.
Stop Function
Function Name: nfStop
Description: Used to return the key after entry is completed.
If the stop function is not executed, it is automatically returned according to the segment's timeout setting.
Parameters:
| Parameter | Type | Description |
|---|---|---|
projectKey | String | Basic control project key from console |
segmentKey | String | Basic control segment key from console |
Example:
Netfunnel.instance.nfStop(
projectKey: '{{PROJECT_KEY}}',
segmentKey: '{{SEGMENT_KEY}}',
);
Related Documentation
- Common Guide: Detailed explanation of basic control
- Section Control: For multi-step processes
- API Reference: Complete function specifications
- Troubleshooting: Common issues and solutions