writeFile method

Future<void> writeFile(
  1. String path,
  2. dynamic data, {
  3. bool checked = false,
})

Writes data to a file on the Frame device.

Args: path (String): The full filename to write on the Frame. data (dynamic): The data to write to the file. Must be either a String or Uint8List. checked (bool, optional): If true, each step of writing will wait for acknowledgement from the Frame before continuing. Defaults to false.

Throws: ArgumentError: If the data is not a String or Uint8List.

Implementation

Future<void> writeFile(String path, dynamic data,
    {bool checked = false}) async {
  if (data is String) {
    data = utf8.encode(data);
  } else if (data is! Uint8List) {
    throw ArgumentError('Data must be either a String or Uint8List');
  }
  await _writeFileRawBytes(path, data as Uint8List, checked: checked);
}