I/Choreographer(25376): Skipped 1 frames! The application may be doing too much work on its main thread.I/flutter (25376): Connected to OneDrive.I/flutter (25376): Attempting to upload CSV file to OneDrive...I/flutter (25376): Failed to upload CSV file to OneDrive.[AndroidInAppWebViewWidget] (android) AndroidInAppWebViewWidget ID 4 calling "dispose" using []D/Surface (25376): Surface::disconnect(this=0x73fa2be000,api=1)I/BufferQueueProducer(25376): [ImageReader-1456x720f1m3-25376-9](this:0x73ced80000,id:9,api:1,p:25376,c:25376) disconnect(P): api 1D/Surface (25376): Surface::connect(this=0x73f9e81000,api=1)D/mali_winsys(25376): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000I/GED (25376): ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 24, oppidx_max 24, oppidx_min 0I/BufferQueue(25376): [ImageReader-1456x720f1m3-25376-9](this:0x73ced80000,id:9,api:1,p:-1,c:-1) ~BufferQueueCoreI/Choreographer(25376): Skipped 2 frames! The application may be doing too much work on its main thread.2I/GED (25376): ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 24, oppidx_max 24, oppidx_min 0E/chromium(25376): [ERROR:aw_browser_terminator.cc(166)] Renderer process (29179) crash detected (code -1).
以下是我尝试将文件上传到 OneDrive 时在日志中看到的内容。
Future<void> _connectToOneDrive(BuildContext context) async {
final onedrive = OneDrive(
redirectURL: "https://login.live.com/oauth20_desktop.srf",
clientID: clientID,
);
final success = await onedrive.connect(context);
if (success) {
print("Connected to OneDrive.");
_uploadCsvToOneDrive(onedrive);
}
}
Future<void> _uploadCsvToOneDrive(OneDrive onedrive) async {
final csvData = convertToCsv(rows);
final data = Uint8List.fromList(utf8.encode(csvData));
try {
print('Attempting to upload CSV file to OneDrive...');
final success = await onedrive.push(data, "data.csv");
if (!success) {
print('Failed to upload CSV file to OneDrive.');
} else {
print('CSV file uploaded successfully.');
}
} catch (e, stackTrace) {
print('Error during upload: $e');
print('Stack trace: $stackTrace');
}
}
以下是我用来将数据上传到 One Drive 的函数。我可以按照日志所述连接到 OneDrive 帐户,但在上传时却无法连接。
我可以知道正确的方法吗?
使用的软件包是 flutter_onedrive: ^1.4.0 和 oauth_webauth: ^5.1.0。
推这个:
final csvData = convertToCsv(rows);
final data = Uint8List.fromList(utf8.encode(csvData));
前往隔离区。 它可能严重占用 CPU 资源。 您可以简单地通过以下方式做到这一点:
import 'dart:async';
final data = await Isolate.run(() {
final csvData = convertToCsv(rows);
return Uint8List.fromList(utf8.encode(csvData));
};
您已经在异步函数中,因此等待不需要编辑。