getTorrents method Null safety

Future<List<Torrent>> getTorrents(
  1. {List<String> fields = const ['id', 'name', 'eta', 'queuePosition', 'downloadDir', 'isFinished', 'isStalled', 'leftUntilDone', 'metadataPercentComplete', 'error', 'errorString', 'percentDone', 'totalSize', 'peersConnected', 'sizeWhenDone', 'status', 'rateDownload', 'rateUpload', 'peersGettingFromUs', 'peersSendingToUs']}

Get the list of torrents, fields can be provided to get only needed information fields to retrieve, can be checked at Returns list of Torrent currently in transmission instance Throws TransmissionException if errors


Future<List<Torrent>> getTorrents({
  List<String> fields = const [
}) async {
  final results = await'/',
      data: _Request(methodGetTorrent, arguments: {
        'fields': fields,
  final response = _Response.fromJSON(;
  final torrentsData = response.arguments!['torrents'];
  return torrentsData
      .map((data) => Torrent._(data))
      .toList(growable: false);