getFlatFolderTree method

Future<Map<String, dynamic>> getFlatFolderTree(
  1. String folderUuid
)

Implementation

Future<Map<String, dynamic>> getFlatFolderTree(String folderUuid) async {
  final deviceId = crypto.uuid();
  api.log('Fetching flat tree for $folderUuid (DeviceID: $deviceId)...');

  final response = await api.makeRequest(
    'POST',
    Uri.parse('${FilenApi.apiUrl}/v3/dir/tree'),
    body: json.encode({
      'uuid': folderUuid,
      'deviceId': deviceId,
      'skipCache': 0,
    }),
  );

  final data = json.decode(response.body);
  if (data['status'] != true) {
    throw Exception(data['message'] ?? 'Failed to fetch tree');
  }
  return data['data'] ?? {};
}