fileQuery static method

String fileQuery(
  1. String name, {
  2. String? mimeType,
  3. String? parent,
  4. bool trashed = false,
})

Implementation

static String fileQuery(
  /// The name of the file being looked for.
  final String name, {

  /// The mimetype of the file to find. You can use the consts in the MimeType class for easier access.
  final String? mimeType,

  /// The ID of the parent folder to look in.
  final String? parent,

  /// Whether the search should include or exclude trashed items. Excluded by default.
  final bool trashed = false,
}) {
  String queryBuilder = "name='$name' and trashed = $trashed ";
  if (mimeType != null) {
    queryBuilder += "and mimeType = '$mimeType' ";
  }
  if (parent != null) {
    queryBuilder += "and $parent in parents ";
  }
  // final query = "name='${name}' and trashed = false ${mimeType == null ? '' : 'mimeType=''} ${parent != null ? "and ${parent} in parents" : ""}";
  print('Executing query: $queryBuilder');
  return queryBuilder;
}