Installation
Add the Bit2Connect Flutter SDK to yourpubspec.yaml:
Setup
1. Initialize the SDK
Initialize the SDK in your app’s main function:2. Configure Deep Link Handling
Add deep link handling to your app:API Reference
Bit2ConnectSDK
The main SDK class for handling dynamic links.Methods
initialize({required String apiKey, required String projectId})
Initialize the Bit2Connect SDK with your API credentials.
Parameters:
apiKey(String): Your Bit2Connect API keyprojectId(String): Your project ID
getInitialLink()
Get the initial dynamic link that launched the app (if any).
Returns: Future<DynamicLinkData?>
Example:
onLinkReceived
Stream that emits dynamic link data when a new link is received.
Type: Stream<DynamicLinkData>
Example:
DynamicLinkData
Represents the data from a dynamic link.Properties
shortUrl(String): The shortened Bit2Connect URLoriginalUrl(String): The original URL that was shortenedpayload(Map<String, dynamic>?): Custom data associated with the linkcreatedAt(DateTime): When the link was createdexpiresAt(DateTime?): When the link expires (if applicable)
Platform Configuration
Android Configuration
Add the following to yourandroid/app/src/main/AndroidManifest.xml:
iOS Configuration
Add the following to yourios/Runner/Info.plist:
Testing
Test Dynamic Links
You can test your integration using the Bit2Connect dashboard or API:Debug Mode
Enable debug logging to troubleshoot issues:Best Practices
Error Handling
Always handle potential errors when processing dynamic links
User Experience
Provide fallback navigation for invalid or expired links
Security
Validate link data before processing to ensure security
Performance
Cache link data when appropriate to improve app performance
Troubleshooting
Common Issues
Links not being received
Links not being received
Solution: Ensure your app is properly configured for deep linking and
the SDK is initialized before handling links.
iOS links not working
iOS links not working
Solution: Verify that your iOS app’s URL scheme is correctly configured in
Info.plist and that the app is properly signed.
Android links not working
Android links not working
Solution: Check that your Android manifest includes the correct intent
filters and that your app is set as the default handler for Bit2Connect
links.
Debug Tips
- Enable debug mode to see detailed logging
- Test with the Bit2Connect dashboard link tester
- Verify your app’s deep link configuration
- Check that your API key has the correct permissions
Example App
For a complete working example, check out our Flutter example repository:- Complete SDK integration
- Deferred deep linking
- Dynamic link creation
- Error handling
- Cross-platform support