startAssessment method
Future<void>
startAssessment({
- required AssessmentTypes type,
- String? assessmentID,
- Map<
String, dynamic> ? userData, - bool showSummary = false,
- void onHandle()?,
override
Implementation
@override
Future<void> startAssessment({
required AssessmentTypes type,
String? assessmentID,
Map<String, dynamic>? userData,
bool showSummary = false,
void Function(SMKitStatus)? onHandle,
}) async {
final subscription =
eventChannel.receiveBroadcastStream().listen((Object? event) {
_onEvent(event, onHandle);
});
try {
final arg = {
'type': type.rawValue,
'id': assessmentID,
if (userData != null) 'userData': userData,
'showSummary': showSummary,
};
await methodChannel.invokeMethod('startAssessment', arg);
subscription.cancel();
} on PlatformException catch (e) {
debugPrint('PlatformException: ${e.code} ${e.message}');
}
}