Installation
Beta
The mobile SDKs are currently in beta. If you encounter any issues, please contact us.
Requirements
- Flutter 3.19.0+
- Dart SDK 3.3.0+
- iOS 14.0+
- Android API 26+ (Android 8.0)
Installation
Add the dependency to your pubspec.yaml:
dependencies:
upscopeio_flutter_sdk:
git:
url: https://github.com/nicatdcw/flutter-sdk.git
ref: main
Then run:
flutter pub get
Initialization
Register the method channel and initialize the SDK early in your app:
import 'package:upscopeio_flutter_sdk/upscopeio_flutter_sdk.dart';
void main() {
UpscopeMethodChannel.register();
runApp(const MyApp());
}
Then initialize in your root widget:
import 'package:upscopeio_flutter_sdk/upscopeio_flutter_sdk.dart';
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
_initUpscope();
}
Future<void> _initUpscope() async {
await Upscope.instance.initialize(
UpscopeConfiguration(apiKey: 'YOUR_API_KEY'),
);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomeScreen(),
);
}
}
The SDK auto-connects by default. To disable this, set autoConnect: false in the configuration and call Upscope.instance.connect() manually when ready.
Public API Key
You can find your public API key in the installation page of your Co-Browsing API dashboard.
ConnectionState Name Collision
Flutter's material.dart exports its own ConnectionState. To avoid conflicts, hide it when importing the SDK:
import 'package:flutter/material.dart' hide ConnectionState;
import 'package:upscopeio_flutter_sdk/upscopeio_flutter_sdk.dart';
Full Device Screen Sharing
The Flutter SDK supports full device screen sharing, but it requires platform-specific setup:
- iOS: Requires a Broadcast Upload Extension. See the iOS full device screen sharing guide.
- Android: Requires adding two permissions to your
AndroidManifest.xml. See the Android full device screen sharing guide.
Lookup Code on Shake
By default, shaking the device will display the lookup code in a dialog. This can be disabled via configuration options.