mirror of
https://github.com/linagora/tmail-flutter.git
synced 2026-12-05 08:05:07 +00:00
26 lines
782 B
Dart
26 lines
782 B
Dart
import 'dart:js_interop';
|
|
import 'dart:js_interop_unsafe';
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
/// Web: tags this page with [caseId] so the sidecar can find it over CDP,
|
|
/// then asks the sidecar to take a heap snapshot (`<sidecarUrl>/snapshot`).
|
|
Future<void> postSample({
|
|
required String sidecarUrl,
|
|
required String caseId,
|
|
required String label,
|
|
}) async {
|
|
globalContext['__tmailMemoryProbeId'] = caseId.toJS;
|
|
final response = await Dio().post<String>(
|
|
'$sidecarUrl/snapshot',
|
|
queryParameters: {'case': caseId, 'label': label},
|
|
options: Options(
|
|
receiveTimeout: const Duration(seconds: 120),
|
|
validateStatus: (_) => true,
|
|
),
|
|
);
|
|
if (response.statusCode != 200) {
|
|
throw StateError('sidecar ${response.statusCode}: ${response.data}');
|
|
}
|
|
}
|