readInPlace method
Future<String?>
readInPlace({
- required String containerId,
- required String relativePath,
- List<
Duration> ? idleTimeouts, - List<
Duration> ? retryBackoff,
override
Read a file in place from the iCloud container using coordinated access.
containerId is the iCloud Container Id.
relativePath is the relative path to the file inside the container.
Trailing slashes are rejected here because reads are file-centric.
Returns the file contents as a String. Coordinated access uses UIDocument/NSDocument and loads the full contents into memory. Text is decoded as UTF-8; use readInPlaceBytes for binary formats.
Throws on file-not-found and other failures.
idleTimeouts controls idle watchdog timeouts between retries.
retryBackoff controls retry delays between attempts.
Implementation
@override
Future<String?> readInPlace({
required String containerId,
required String relativePath,
List<Duration>? idleTimeouts,
List<Duration>? retryBackoff,
}) async {
final result = await methodChannel.invokeMethod<String>(
'readInPlace',
{
'containerId': containerId,
'relativePath': relativePath,
// Send integer seconds; sub-second precision is intentionally ignored.
if (idleTimeouts != null)
'idleTimeoutSeconds': idleTimeouts
.map((duration) => duration.inSeconds)
.toList(growable: false),
if (retryBackoff != null)
'retryBackoffSeconds': retryBackoff
.map((duration) => duration.inSeconds)
.toList(growable: false),
},
);
return result;
}