getDownloadFolderItems method

  1. @override
Future<List<FileModel>> getDownloadFolderItems({
  1. DateTime? fromDate,
  2. int? limit,
  3. bool orderByDesc = true,
  4. bool sortBySize = false,
  5. bool sortByName = false,
  6. String? keyword,
})
override

Fetches files from the Download folder with optional filters.

Implementation

@override
Future<List<FileModel>> getDownloadFolderItems({
  DateTime? fromDate,
  int? limit,
  bool orderByDesc = true,
  bool sortBySize = false,
  bool sortByName = false,
  String? keyword,
}) async {
  final Map<String, dynamic> arguments = {
    'fromDate': fromDate?.millisecondsSinceEpoch,
    'limit': limit,
    'orderByDesc': orderByDesc,
    'sortBySize': sortBySize,
    'sortByName': sortByName,
    'keyword': keyword,
  };

  final result = await methodChannel.invokeMethod<List<dynamic>>(
    'getDownloadFolderItems',
    arguments,
  );
  return result
          ?.map((e) => FileModel.fromMap(Map<String, dynamic>.from(e)))
          .toList() ??
      [];
}