torrent fix

This commit is contained in:
royalcat 2024-08-15 11:23:44 +03:00
parent 57ada71d36
commit e517332a65
26 changed files with 2240 additions and 850 deletions

View file

@ -11,6 +11,8 @@ targets:
type: String
DateTime:
type: DateTime
UInt:
type: int
clients:
- graphql
- graphql_flutter

View file

@ -1033,6 +1033,282 @@ class _CopyWithStubImpl$Input$TorrentFilter<TRes>
_res;
}
class Input$TorrentPriorityFilter {
factory Input$TorrentPriorityFilter({
Enum$TorrentPriority? eq,
Enum$TorrentPriority? gt,
Enum$TorrentPriority? lt,
Enum$TorrentPriority? gte,
Enum$TorrentPriority? lte,
List<Enum$TorrentPriority>? $in,
}) =>
Input$TorrentPriorityFilter._({
if (eq != null) r'eq': eq,
if (gt != null) r'gt': gt,
if (lt != null) r'lt': lt,
if (gte != null) r'gte': gte,
if (lte != null) r'lte': lte,
if ($in != null) r'in': $in,
});
Input$TorrentPriorityFilter._(this._$data);
factory Input$TorrentPriorityFilter.fromJson(Map<String, dynamic> data) {
final result$data = <String, dynamic>{};
if (data.containsKey('eq')) {
final l$eq = data['eq'];
result$data['eq'] =
l$eq == null ? null : fromJson$Enum$TorrentPriority((l$eq as String));
}
if (data.containsKey('gt')) {
final l$gt = data['gt'];
result$data['gt'] =
l$gt == null ? null : fromJson$Enum$TorrentPriority((l$gt as String));
}
if (data.containsKey('lt')) {
final l$lt = data['lt'];
result$data['lt'] =
l$lt == null ? null : fromJson$Enum$TorrentPriority((l$lt as String));
}
if (data.containsKey('gte')) {
final l$gte = data['gte'];
result$data['gte'] = l$gte == null
? null
: fromJson$Enum$TorrentPriority((l$gte as String));
}
if (data.containsKey('lte')) {
final l$lte = data['lte'];
result$data['lte'] = l$lte == null
? null
: fromJson$Enum$TorrentPriority((l$lte as String));
}
if (data.containsKey('in')) {
final l$$in = data['in'];
result$data['in'] = (l$$in as List<dynamic>?)
?.map((e) => fromJson$Enum$TorrentPriority((e as String)))
.toList();
}
return Input$TorrentPriorityFilter._(result$data);
}
Map<String, dynamic> _$data;
Enum$TorrentPriority? get eq => (_$data['eq'] as Enum$TorrentPriority?);
Enum$TorrentPriority? get gt => (_$data['gt'] as Enum$TorrentPriority?);
Enum$TorrentPriority? get lt => (_$data['lt'] as Enum$TorrentPriority?);
Enum$TorrentPriority? get gte => (_$data['gte'] as Enum$TorrentPriority?);
Enum$TorrentPriority? get lte => (_$data['lte'] as Enum$TorrentPriority?);
List<Enum$TorrentPriority>? get $in =>
(_$data['in'] as List<Enum$TorrentPriority>?);
Map<String, dynamic> toJson() {
final result$data = <String, dynamic>{};
if (_$data.containsKey('eq')) {
final l$eq = eq;
result$data['eq'] =
l$eq == null ? null : toJson$Enum$TorrentPriority(l$eq);
}
if (_$data.containsKey('gt')) {
final l$gt = gt;
result$data['gt'] =
l$gt == null ? null : toJson$Enum$TorrentPriority(l$gt);
}
if (_$data.containsKey('lt')) {
final l$lt = lt;
result$data['lt'] =
l$lt == null ? null : toJson$Enum$TorrentPriority(l$lt);
}
if (_$data.containsKey('gte')) {
final l$gte = gte;
result$data['gte'] =
l$gte == null ? null : toJson$Enum$TorrentPriority(l$gte);
}
if (_$data.containsKey('lte')) {
final l$lte = lte;
result$data['lte'] =
l$lte == null ? null : toJson$Enum$TorrentPriority(l$lte);
}
if (_$data.containsKey('in')) {
final l$$in = $in;
result$data['in'] =
l$$in?.map((e) => toJson$Enum$TorrentPriority(e)).toList();
}
return result$data;
}
CopyWith$Input$TorrentPriorityFilter<Input$TorrentPriorityFilter>
get copyWith => CopyWith$Input$TorrentPriorityFilter(
this,
(i) => i,
);
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (!(other is Input$TorrentPriorityFilter) ||
runtimeType != other.runtimeType) {
return false;
}
final l$eq = eq;
final lOther$eq = other.eq;
if (_$data.containsKey('eq') != other._$data.containsKey('eq')) {
return false;
}
if (l$eq != lOther$eq) {
return false;
}
final l$gt = gt;
final lOther$gt = other.gt;
if (_$data.containsKey('gt') != other._$data.containsKey('gt')) {
return false;
}
if (l$gt != lOther$gt) {
return false;
}
final l$lt = lt;
final lOther$lt = other.lt;
if (_$data.containsKey('lt') != other._$data.containsKey('lt')) {
return false;
}
if (l$lt != lOther$lt) {
return false;
}
final l$gte = gte;
final lOther$gte = other.gte;
if (_$data.containsKey('gte') != other._$data.containsKey('gte')) {
return false;
}
if (l$gte != lOther$gte) {
return false;
}
final l$lte = lte;
final lOther$lte = other.lte;
if (_$data.containsKey('lte') != other._$data.containsKey('lte')) {
return false;
}
if (l$lte != lOther$lte) {
return false;
}
final l$$in = $in;
final lOther$$in = other.$in;
if (_$data.containsKey('in') != other._$data.containsKey('in')) {
return false;
}
if (l$$in != null && lOther$$in != null) {
if (l$$in.length != lOther$$in.length) {
return false;
}
for (int i = 0; i < l$$in.length; i++) {
final l$$in$entry = l$$in[i];
final lOther$$in$entry = lOther$$in[i];
if (l$$in$entry != lOther$$in$entry) {
return false;
}
}
} else if (l$$in != lOther$$in) {
return false;
}
return true;
}
@override
int get hashCode {
final l$eq = eq;
final l$gt = gt;
final l$lt = lt;
final l$gte = gte;
final l$lte = lte;
final l$$in = $in;
return Object.hashAll([
_$data.containsKey('eq') ? l$eq : const {},
_$data.containsKey('gt') ? l$gt : const {},
_$data.containsKey('lt') ? l$lt : const {},
_$data.containsKey('gte') ? l$gte : const {},
_$data.containsKey('lte') ? l$lte : const {},
_$data.containsKey('in')
? l$$in == null
? null
: Object.hashAll(l$$in.map((v) => v))
: const {},
]);
}
}
abstract class CopyWith$Input$TorrentPriorityFilter<TRes> {
factory CopyWith$Input$TorrentPriorityFilter(
Input$TorrentPriorityFilter instance,
TRes Function(Input$TorrentPriorityFilter) then,
) = _CopyWithImpl$Input$TorrentPriorityFilter;
factory CopyWith$Input$TorrentPriorityFilter.stub(TRes res) =
_CopyWithStubImpl$Input$TorrentPriorityFilter;
TRes call({
Enum$TorrentPriority? eq,
Enum$TorrentPriority? gt,
Enum$TorrentPriority? lt,
Enum$TorrentPriority? gte,
Enum$TorrentPriority? lte,
List<Enum$TorrentPriority>? $in,
});
}
class _CopyWithImpl$Input$TorrentPriorityFilter<TRes>
implements CopyWith$Input$TorrentPriorityFilter<TRes> {
_CopyWithImpl$Input$TorrentPriorityFilter(
this._instance,
this._then,
);
final Input$TorrentPriorityFilter _instance;
final TRes Function(Input$TorrentPriorityFilter) _then;
static const _undefined = <dynamic, dynamic>{};
TRes call({
Object? eq = _undefined,
Object? gt = _undefined,
Object? lt = _undefined,
Object? gte = _undefined,
Object? lte = _undefined,
Object? $in = _undefined,
}) =>
_then(Input$TorrentPriorityFilter._({
..._instance._$data,
if (eq != _undefined) 'eq': (eq as Enum$TorrentPriority?),
if (gt != _undefined) 'gt': (gt as Enum$TorrentPriority?),
if (lt != _undefined) 'lt': (lt as Enum$TorrentPriority?),
if (gte != _undefined) 'gte': (gte as Enum$TorrentPriority?),
if (lte != _undefined) 'lte': (lte as Enum$TorrentPriority?),
if ($in != _undefined) 'in': ($in as List<Enum$TorrentPriority>?),
}));
}
class _CopyWithStubImpl$Input$TorrentPriorityFilter<TRes>
implements CopyWith$Input$TorrentPriorityFilter<TRes> {
_CopyWithStubImpl$Input$TorrentPriorityFilter(this._res);
TRes _res;
call({
Enum$TorrentPriority? eq,
Enum$TorrentPriority? gt,
Enum$TorrentPriority? lt,
Enum$TorrentPriority? gte,
Enum$TorrentPriority? lte,
List<Enum$TorrentPriority>? $in,
}) =>
_res;
}
class Input$TorrentsFilter {
factory Input$TorrentsFilter({
Input$StringFilter? infohash,
@ -1040,7 +1316,7 @@ class Input$TorrentsFilter {
Input$IntFilter? bytesCompleted,
Input$IntFilter? bytesMissing,
Input$IntFilter? peersCount,
Input$BooleanFilter? downloading,
Input$TorrentPriorityFilter? priority,
}) =>
Input$TorrentsFilter._({
if (infohash != null) r'infohash': infohash,
@ -1048,7 +1324,7 @@ class Input$TorrentsFilter {
if (bytesCompleted != null) r'bytesCompleted': bytesCompleted,
if (bytesMissing != null) r'bytesMissing': bytesMissing,
if (peersCount != null) r'peersCount': peersCount,
if (downloading != null) r'downloading': downloading,
if (priority != null) r'priority': priority,
});
Input$TorrentsFilter._(this._$data);
@ -1086,12 +1362,12 @@ class Input$TorrentsFilter {
? null
: Input$IntFilter.fromJson((l$peersCount as Map<String, dynamic>));
}
if (data.containsKey('downloading')) {
final l$downloading = data['downloading'];
result$data['downloading'] = l$downloading == null
if (data.containsKey('priority')) {
final l$priority = data['priority'];
result$data['priority'] = l$priority == null
? null
: Input$BooleanFilter.fromJson(
(l$downloading as Map<String, dynamic>));
: Input$TorrentPriorityFilter.fromJson(
(l$priority as Map<String, dynamic>));
}
return Input$TorrentsFilter._(result$data);
}
@ -1111,8 +1387,8 @@ class Input$TorrentsFilter {
Input$IntFilter? get peersCount => (_$data['peersCount'] as Input$IntFilter?);
Input$BooleanFilter? get downloading =>
(_$data['downloading'] as Input$BooleanFilter?);
Input$TorrentPriorityFilter? get priority =>
(_$data['priority'] as Input$TorrentPriorityFilter?);
Map<String, dynamic> toJson() {
final result$data = <String, dynamic>{};
@ -1136,9 +1412,9 @@ class Input$TorrentsFilter {
final l$peersCount = peersCount;
result$data['peersCount'] = l$peersCount?.toJson();
}
if (_$data.containsKey('downloading')) {
final l$downloading = downloading;
result$data['downloading'] = l$downloading?.toJson();
if (_$data.containsKey('priority')) {
final l$priority = priority;
result$data['priority'] = l$priority?.toJson();
}
return result$data;
}
@ -1201,13 +1477,13 @@ class Input$TorrentsFilter {
if (l$peersCount != lOther$peersCount) {
return false;
}
final l$downloading = downloading;
final lOther$downloading = other.downloading;
if (_$data.containsKey('downloading') !=
other._$data.containsKey('downloading')) {
final l$priority = priority;
final lOther$priority = other.priority;
if (_$data.containsKey('priority') !=
other._$data.containsKey('priority')) {
return false;
}
if (l$downloading != lOther$downloading) {
if (l$priority != lOther$priority) {
return false;
}
return true;
@ -1220,14 +1496,14 @@ class Input$TorrentsFilter {
final l$bytesCompleted = bytesCompleted;
final l$bytesMissing = bytesMissing;
final l$peersCount = peersCount;
final l$downloading = downloading;
final l$priority = priority;
return Object.hashAll([
_$data.containsKey('infohash') ? l$infohash : const {},
_$data.containsKey('name') ? l$name : const {},
_$data.containsKey('bytesCompleted') ? l$bytesCompleted : const {},
_$data.containsKey('bytesMissing') ? l$bytesMissing : const {},
_$data.containsKey('peersCount') ? l$peersCount : const {},
_$data.containsKey('downloading') ? l$downloading : const {},
_$data.containsKey('priority') ? l$priority : const {},
]);
}
}
@ -1247,14 +1523,14 @@ abstract class CopyWith$Input$TorrentsFilter<TRes> {
Input$IntFilter? bytesCompleted,
Input$IntFilter? bytesMissing,
Input$IntFilter? peersCount,
Input$BooleanFilter? downloading,
Input$TorrentPriorityFilter? priority,
});
CopyWith$Input$StringFilter<TRes> get infohash;
CopyWith$Input$StringFilter<TRes> get name;
CopyWith$Input$IntFilter<TRes> get bytesCompleted;
CopyWith$Input$IntFilter<TRes> get bytesMissing;
CopyWith$Input$IntFilter<TRes> get peersCount;
CopyWith$Input$BooleanFilter<TRes> get downloading;
CopyWith$Input$TorrentPriorityFilter<TRes> get priority;
}
class _CopyWithImpl$Input$TorrentsFilter<TRes>
@ -1276,7 +1552,7 @@ class _CopyWithImpl$Input$TorrentsFilter<TRes>
Object? bytesCompleted = _undefined,
Object? bytesMissing = _undefined,
Object? peersCount = _undefined,
Object? downloading = _undefined,
Object? priority = _undefined,
}) =>
_then(Input$TorrentsFilter._({
..._instance._$data,
@ -1289,8 +1565,8 @@ class _CopyWithImpl$Input$TorrentsFilter<TRes>
'bytesMissing': (bytesMissing as Input$IntFilter?),
if (peersCount != _undefined)
'peersCount': (peersCount as Input$IntFilter?),
if (downloading != _undefined)
'downloading': (downloading as Input$BooleanFilter?),
if (priority != _undefined)
'priority': (priority as Input$TorrentPriorityFilter?),
}));
CopyWith$Input$StringFilter<TRes> get infohash {
@ -1331,12 +1607,12 @@ class _CopyWithImpl$Input$TorrentsFilter<TRes>
local$peersCount, (e) => call(peersCount: e));
}
CopyWith$Input$BooleanFilter<TRes> get downloading {
final local$downloading = _instance.downloading;
return local$downloading == null
? CopyWith$Input$BooleanFilter.stub(_then(_instance))
: CopyWith$Input$BooleanFilter(
local$downloading, (e) => call(downloading: e));
CopyWith$Input$TorrentPriorityFilter<TRes> get priority {
final local$priority = _instance.priority;
return local$priority == null
? CopyWith$Input$TorrentPriorityFilter.stub(_then(_instance))
: CopyWith$Input$TorrentPriorityFilter(
local$priority, (e) => call(priority: e));
}
}
@ -1352,7 +1628,7 @@ class _CopyWithStubImpl$Input$TorrentsFilter<TRes>
Input$IntFilter? bytesCompleted,
Input$IntFilter? bytesMissing,
Input$IntFilter? peersCount,
Input$BooleanFilter? downloading,
Input$TorrentPriorityFilter? priority,
}) =>
_res;
@ -1371,8 +1647,56 @@ class _CopyWithStubImpl$Input$TorrentsFilter<TRes>
CopyWith$Input$IntFilter<TRes> get peersCount =>
CopyWith$Input$IntFilter.stub(_res);
CopyWith$Input$BooleanFilter<TRes> get downloading =>
CopyWith$Input$BooleanFilter.stub(_res);
CopyWith$Input$TorrentPriorityFilter<TRes> get priority =>
CopyWith$Input$TorrentPriorityFilter.stub(_res);
}
enum Enum$TorrentPriority {
NONE,
NORMAL,
HIGH,
READAHEAD,
NOW,
$unknown;
factory Enum$TorrentPriority.fromJson(String value) =>
fromJson$Enum$TorrentPriority(value);
String toJson() => toJson$Enum$TorrentPriority(this);
}
String toJson$Enum$TorrentPriority(Enum$TorrentPriority e) {
switch (e) {
case Enum$TorrentPriority.NONE:
return r'NONE';
case Enum$TorrentPriority.NORMAL:
return r'NORMAL';
case Enum$TorrentPriority.HIGH:
return r'HIGH';
case Enum$TorrentPriority.READAHEAD:
return r'READAHEAD';
case Enum$TorrentPriority.NOW:
return r'NOW';
case Enum$TorrentPriority.$unknown:
return r'$unknown';
}
}
Enum$TorrentPriority fromJson$Enum$TorrentPriority(String value) {
switch (value) {
case r'NONE':
return Enum$TorrentPriority.NONE;
case r'NORMAL':
return Enum$TorrentPriority.NORMAL;
case r'HIGH':
return Enum$TorrentPriority.HIGH;
case r'READAHEAD':
return Enum$TorrentPriority.READAHEAD;
case r'NOW':
return Enum$TorrentPriority.NOW;
default:
return Enum$TorrentPriority.$unknown;
}
}
enum Enum$__TypeKind {

View file

@ -1,25 +1,21 @@
mutation MarkTorrentDownload($infohash: String!) {
downloadTorrent(infohash: $infohash) {
task {
id
}
mutation MarkTorrentDownload($infohash: String!, $priority: TorrentPriority! = NORMAL) {
torrentDaemon {
setTorrentPriority(infohash: $infohash, priority: $priority)
}
}
query ListTorrents($downloading: Boolean) {
torrents(filter: {
downloading: {
eq: $downloading
}
}) {
name
infohash
bytesCompleted
bytesMissing
peers {
ip
downloadRate
clientName
query ListTorrents {
torrentDaemon {
torrents {
name
infohash
bytesCompleted
bytesMissing
peers {
ip
downloadRate
clientName
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,13 @@
query TorrentTotalStats($since: DateTime!) {
torrentDaemon {
statsHistory(since: $since) {
timestamp
downloadedBytes
uploadedBytes
totalPeers
activePeers
connectedSeeders
}
}
}

View file

@ -0,0 +1,901 @@
// ignore_for_file: type=lint
import 'dart:async';
import 'package:flutter/widgets.dart' as widgets;
import 'package:gql/ast.dart';
import 'package:graphql/client.dart' as graphql;
import 'package:graphql_flutter/graphql_flutter.dart' as graphql_flutter;
class Variables$Query$TorrentTotalStats {
factory Variables$Query$TorrentTotalStats({required DateTime since}) =>
Variables$Query$TorrentTotalStats._({
r'since': since,
});
Variables$Query$TorrentTotalStats._(this._$data);
factory Variables$Query$TorrentTotalStats.fromJson(
Map<String, dynamic> data) {
final result$data = <String, dynamic>{};
final l$since = data['since'];
result$data['since'] = DateTime.parse((l$since as String));
return Variables$Query$TorrentTotalStats._(result$data);
}
Map<String, dynamic> _$data;
DateTime get since => (_$data['since'] as DateTime);
Map<String, dynamic> toJson() {
final result$data = <String, dynamic>{};
final l$since = since;
result$data['since'] = l$since.toIso8601String();
return result$data;
}
CopyWith$Variables$Query$TorrentTotalStats<Variables$Query$TorrentTotalStats>
get copyWith => CopyWith$Variables$Query$TorrentTotalStats(
this,
(i) => i,
);
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (!(other is Variables$Query$TorrentTotalStats) ||
runtimeType != other.runtimeType) {
return false;
}
final l$since = since;
final lOther$since = other.since;
if (l$since != lOther$since) {
return false;
}
return true;
}
@override
int get hashCode {
final l$since = since;
return Object.hashAll([l$since]);
}
}
abstract class CopyWith$Variables$Query$TorrentTotalStats<TRes> {
factory CopyWith$Variables$Query$TorrentTotalStats(
Variables$Query$TorrentTotalStats instance,
TRes Function(Variables$Query$TorrentTotalStats) then,
) = _CopyWithImpl$Variables$Query$TorrentTotalStats;
factory CopyWith$Variables$Query$TorrentTotalStats.stub(TRes res) =
_CopyWithStubImpl$Variables$Query$TorrentTotalStats;
TRes call({DateTime? since});
}
class _CopyWithImpl$Variables$Query$TorrentTotalStats<TRes>
implements CopyWith$Variables$Query$TorrentTotalStats<TRes> {
_CopyWithImpl$Variables$Query$TorrentTotalStats(
this._instance,
this._then,
);
final Variables$Query$TorrentTotalStats _instance;
final TRes Function(Variables$Query$TorrentTotalStats) _then;
static const _undefined = <dynamic, dynamic>{};
TRes call({Object? since = _undefined}) =>
_then(Variables$Query$TorrentTotalStats._({
..._instance._$data,
if (since != _undefined && since != null) 'since': (since as DateTime),
}));
}
class _CopyWithStubImpl$Variables$Query$TorrentTotalStats<TRes>
implements CopyWith$Variables$Query$TorrentTotalStats<TRes> {
_CopyWithStubImpl$Variables$Query$TorrentTotalStats(this._res);
TRes _res;
call({DateTime? since}) => _res;
}
class Query$TorrentTotalStats {
Query$TorrentTotalStats({
this.torrentDaemon,
this.$__typename = 'Query',
});
factory Query$TorrentTotalStats.fromJson(Map<String, dynamic> json) {
final l$torrentDaemon = json['torrentDaemon'];
final l$$__typename = json['__typename'];
return Query$TorrentTotalStats(
torrentDaemon: l$torrentDaemon == null
? null
: Query$TorrentTotalStats$torrentDaemon.fromJson(
(l$torrentDaemon as Map<String, dynamic>)),
$__typename: (l$$__typename as String),
);
}
final Query$TorrentTotalStats$torrentDaemon? torrentDaemon;
final String $__typename;
Map<String, dynamic> toJson() {
final _resultData = <String, dynamic>{};
final l$torrentDaemon = torrentDaemon;
_resultData['torrentDaemon'] = l$torrentDaemon?.toJson();
final l$$__typename = $__typename;
_resultData['__typename'] = l$$__typename;
return _resultData;
}
@override
int get hashCode {
final l$torrentDaemon = torrentDaemon;
final l$$__typename = $__typename;
return Object.hashAll([
l$torrentDaemon,
l$$__typename,
]);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (!(other is Query$TorrentTotalStats) ||
runtimeType != other.runtimeType) {
return false;
}
final l$torrentDaemon = torrentDaemon;
final lOther$torrentDaemon = other.torrentDaemon;
if (l$torrentDaemon != lOther$torrentDaemon) {
return false;
}
final l$$__typename = $__typename;
final lOther$$__typename = other.$__typename;
if (l$$__typename != lOther$$__typename) {
return false;
}
return true;
}
}
extension UtilityExtension$Query$TorrentTotalStats on Query$TorrentTotalStats {
CopyWith$Query$TorrentTotalStats<Query$TorrentTotalStats> get copyWith =>
CopyWith$Query$TorrentTotalStats(
this,
(i) => i,
);
}
abstract class CopyWith$Query$TorrentTotalStats<TRes> {
factory CopyWith$Query$TorrentTotalStats(
Query$TorrentTotalStats instance,
TRes Function(Query$TorrentTotalStats) then,
) = _CopyWithImpl$Query$TorrentTotalStats;
factory CopyWith$Query$TorrentTotalStats.stub(TRes res) =
_CopyWithStubImpl$Query$TorrentTotalStats;
TRes call({
Query$TorrentTotalStats$torrentDaemon? torrentDaemon,
String? $__typename,
});
CopyWith$Query$TorrentTotalStats$torrentDaemon<TRes> get torrentDaemon;
}
class _CopyWithImpl$Query$TorrentTotalStats<TRes>
implements CopyWith$Query$TorrentTotalStats<TRes> {
_CopyWithImpl$Query$TorrentTotalStats(
this._instance,
this._then,
);
final Query$TorrentTotalStats _instance;
final TRes Function(Query$TorrentTotalStats) _then;
static const _undefined = <dynamic, dynamic>{};
TRes call({
Object? torrentDaemon = _undefined,
Object? $__typename = _undefined,
}) =>
_then(Query$TorrentTotalStats(
torrentDaemon: torrentDaemon == _undefined
? _instance.torrentDaemon
: (torrentDaemon as Query$TorrentTotalStats$torrentDaemon?),
$__typename: $__typename == _undefined || $__typename == null
? _instance.$__typename
: ($__typename as String),
));
CopyWith$Query$TorrentTotalStats$torrentDaemon<TRes> get torrentDaemon {
final local$torrentDaemon = _instance.torrentDaemon;
return local$torrentDaemon == null
? CopyWith$Query$TorrentTotalStats$torrentDaemon.stub(_then(_instance))
: CopyWith$Query$TorrentTotalStats$torrentDaemon(
local$torrentDaemon, (e) => call(torrentDaemon: e));
}
}
class _CopyWithStubImpl$Query$TorrentTotalStats<TRes>
implements CopyWith$Query$TorrentTotalStats<TRes> {
_CopyWithStubImpl$Query$TorrentTotalStats(this._res);
TRes _res;
call({
Query$TorrentTotalStats$torrentDaemon? torrentDaemon,
String? $__typename,
}) =>
_res;
CopyWith$Query$TorrentTotalStats$torrentDaemon<TRes> get torrentDaemon =>
CopyWith$Query$TorrentTotalStats$torrentDaemon.stub(_res);
}
const documentNodeQueryTorrentTotalStats = DocumentNode(definitions: [
OperationDefinitionNode(
type: OperationType.query,
name: NameNode(value: 'TorrentTotalStats'),
variableDefinitions: [
VariableDefinitionNode(
variable: VariableNode(name: NameNode(value: 'since')),
type: NamedTypeNode(
name: NameNode(value: 'DateTime'),
isNonNull: true,
),
defaultValue: DefaultValueNode(value: null),
directives: [],
)
],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'torrentDaemon'),
alias: null,
arguments: [],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'statsHistory'),
alias: null,
arguments: [
ArgumentNode(
name: NameNode(value: 'since'),
value: VariableNode(name: NameNode(value: 'since')),
)
],
directives: [],
selectionSet: SelectionSetNode(selections: [
FieldNode(
name: NameNode(value: 'timestamp'),
alias: null,
arguments: [],
directives: [],
selectionSet: null,
),
FieldNode(
name: NameNode(value: 'downloadedBytes'),
alias: null,
arguments: [],
directives: [],
selectionSet: null,
),
FieldNode(
name: NameNode(value: 'uploadedBytes'),
alias: null,
arguments: [],
directives: [],
selectionSet: null,
),
FieldNode(
name: NameNode(value: 'totalPeers'),
alias: null,
arguments: [],
directives: [],
selectionSet: null,
),
FieldNode(
name: NameNode(value: 'activePeers'),
alias: null,
arguments: [],
directives: [],
selectionSet: null,
),
FieldNode(
name: NameNode(value: 'connectedSeeders'),
alias: null,
arguments: [],
directives: [],
selectionSet: null,
),
FieldNode(
name: NameNode(value: '__typename'),
alias: null,
arguments: [],
directives: [],
selectionSet: null,
),
]),
),
FieldNode(
name: NameNode(value: '__typename'),
alias: null,
arguments: [],
directives: [],
selectionSet: null,
),
]),
),
FieldNode(
name: NameNode(value: '__typename'),
alias: null,
arguments: [],
directives: [],
selectionSet: null,
),
]),
),
]);
Query$TorrentTotalStats _parserFn$Query$TorrentTotalStats(
Map<String, dynamic> data) =>
Query$TorrentTotalStats.fromJson(data);
typedef OnQueryComplete$Query$TorrentTotalStats = FutureOr<void> Function(
Map<String, dynamic>?,
Query$TorrentTotalStats?,
);
class Options$Query$TorrentTotalStats
extends graphql.QueryOptions<Query$TorrentTotalStats> {
Options$Query$TorrentTotalStats({
String? operationName,
required Variables$Query$TorrentTotalStats variables,
graphql.FetchPolicy? fetchPolicy,
graphql.ErrorPolicy? errorPolicy,
graphql.CacheRereadPolicy? cacheRereadPolicy,
Object? optimisticResult,
Query$TorrentTotalStats? typedOptimisticResult,
Duration? pollInterval,
graphql.Context? context,
OnQueryComplete$Query$TorrentTotalStats? onComplete,
graphql.OnQueryError? onError,
}) : onCompleteWithParsed = onComplete,
super(
variables: variables.toJson(),
operationName: operationName,
fetchPolicy: fetchPolicy,
errorPolicy: errorPolicy,
cacheRereadPolicy: cacheRereadPolicy,
optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(),
pollInterval: pollInterval,
context: context,
onComplete: onComplete == null
? null
: (data) => onComplete(
data,
data == null
? null
: _parserFn$Query$TorrentTotalStats(data),
),
onError: onError,
document: documentNodeQueryTorrentTotalStats,
parserFn: _parserFn$Query$TorrentTotalStats,
);
final OnQueryComplete$Query$TorrentTotalStats? onCompleteWithParsed;
@override
List<Object?> get properties => [
...super.onComplete == null
? super.properties
: super.properties.where((property) => property != onComplete),
onCompleteWithParsed,
];
}
class WatchOptions$Query$TorrentTotalStats
extends graphql.WatchQueryOptions<Query$TorrentTotalStats> {
WatchOptions$Query$TorrentTotalStats({
String? operationName,
required Variables$Query$TorrentTotalStats variables,
graphql.FetchPolicy? fetchPolicy,
graphql.ErrorPolicy? errorPolicy,
graphql.CacheRereadPolicy? cacheRereadPolicy,
Object? optimisticResult,
Query$TorrentTotalStats? typedOptimisticResult,
graphql.Context? context,
Duration? pollInterval,
bool? eagerlyFetchResults,
bool carryForwardDataOnException = true,
bool fetchResults = false,
}) : super(
variables: variables.toJson(),
operationName: operationName,
fetchPolicy: fetchPolicy,
errorPolicy: errorPolicy,
cacheRereadPolicy: cacheRereadPolicy,
optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(),
context: context,
document: documentNodeQueryTorrentTotalStats,
pollInterval: pollInterval,
eagerlyFetchResults: eagerlyFetchResults,
carryForwardDataOnException: carryForwardDataOnException,
fetchResults: fetchResults,
parserFn: _parserFn$Query$TorrentTotalStats,
);
}
class FetchMoreOptions$Query$TorrentTotalStats
extends graphql.FetchMoreOptions {
FetchMoreOptions$Query$TorrentTotalStats({
required graphql.UpdateQuery updateQuery,
required Variables$Query$TorrentTotalStats variables,
}) : super(
updateQuery: updateQuery,
variables: variables.toJson(),
document: documentNodeQueryTorrentTotalStats,
);
}
extension ClientExtension$Query$TorrentTotalStats on graphql.GraphQLClient {
Future<graphql.QueryResult<Query$TorrentTotalStats>> query$TorrentTotalStats(
Options$Query$TorrentTotalStats options) async =>
await this.query(options);
graphql.ObservableQuery<Query$TorrentTotalStats> watchQuery$TorrentTotalStats(
WatchOptions$Query$TorrentTotalStats options) =>
this.watchQuery(options);
void writeQuery$TorrentTotalStats({
required Query$TorrentTotalStats data,
required Variables$Query$TorrentTotalStats variables,
bool broadcast = true,
}) =>
this.writeQuery(
graphql.Request(
operation:
graphql.Operation(document: documentNodeQueryTorrentTotalStats),
variables: variables.toJson(),
),
data: data.toJson(),
broadcast: broadcast,
);
Query$TorrentTotalStats? readQuery$TorrentTotalStats({
required Variables$Query$TorrentTotalStats variables,
bool optimistic = true,
}) {
final result = this.readQuery(
graphql.Request(
operation:
graphql.Operation(document: documentNodeQueryTorrentTotalStats),
variables: variables.toJson(),
),
optimistic: optimistic,
);
return result == null ? null : Query$TorrentTotalStats.fromJson(result);
}
}
graphql_flutter.QueryHookResult<Query$TorrentTotalStats>
useQuery$TorrentTotalStats(Options$Query$TorrentTotalStats options) =>
graphql_flutter.useQuery(options);
graphql.ObservableQuery<Query$TorrentTotalStats>
useWatchQuery$TorrentTotalStats(
WatchOptions$Query$TorrentTotalStats options) =>
graphql_flutter.useWatchQuery(options);
class Query$TorrentTotalStats$Widget
extends graphql_flutter.Query<Query$TorrentTotalStats> {
Query$TorrentTotalStats$Widget({
widgets.Key? key,
required Options$Query$TorrentTotalStats options,
required graphql_flutter.QueryBuilder<Query$TorrentTotalStats> builder,
}) : super(
key: key,
options: options,
builder: builder,
);
}
class Query$TorrentTotalStats$torrentDaemon {
Query$TorrentTotalStats$torrentDaemon({
required this.statsHistory,
this.$__typename = 'TorrentDaemonQuery',
});
factory Query$TorrentTotalStats$torrentDaemon.fromJson(
Map<String, dynamic> json) {
final l$statsHistory = json['statsHistory'];
final l$$__typename = json['__typename'];
return Query$TorrentTotalStats$torrentDaemon(
statsHistory: (l$statsHistory as List<dynamic>)
.map((e) =>
Query$TorrentTotalStats$torrentDaemon$statsHistory.fromJson(
(e as Map<String, dynamic>)))
.toList(),
$__typename: (l$$__typename as String),
);
}
final List<Query$TorrentTotalStats$torrentDaemon$statsHistory> statsHistory;
final String $__typename;
Map<String, dynamic> toJson() {
final _resultData = <String, dynamic>{};
final l$statsHistory = statsHistory;
_resultData['statsHistory'] =
l$statsHistory.map((e) => e.toJson()).toList();
final l$$__typename = $__typename;
_resultData['__typename'] = l$$__typename;
return _resultData;
}
@override
int get hashCode {
final l$statsHistory = statsHistory;
final l$$__typename = $__typename;
return Object.hashAll([
Object.hashAll(l$statsHistory.map((v) => v)),
l$$__typename,
]);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (!(other is Query$TorrentTotalStats$torrentDaemon) ||
runtimeType != other.runtimeType) {
return false;
}
final l$statsHistory = statsHistory;
final lOther$statsHistory = other.statsHistory;
if (l$statsHistory.length != lOther$statsHistory.length) {
return false;
}
for (int i = 0; i < l$statsHistory.length; i++) {
final l$statsHistory$entry = l$statsHistory[i];
final lOther$statsHistory$entry = lOther$statsHistory[i];
if (l$statsHistory$entry != lOther$statsHistory$entry) {
return false;
}
}
final l$$__typename = $__typename;
final lOther$$__typename = other.$__typename;
if (l$$__typename != lOther$$__typename) {
return false;
}
return true;
}
}
extension UtilityExtension$Query$TorrentTotalStats$torrentDaemon
on Query$TorrentTotalStats$torrentDaemon {
CopyWith$Query$TorrentTotalStats$torrentDaemon<
Query$TorrentTotalStats$torrentDaemon>
get copyWith => CopyWith$Query$TorrentTotalStats$torrentDaemon(
this,
(i) => i,
);
}
abstract class CopyWith$Query$TorrentTotalStats$torrentDaemon<TRes> {
factory CopyWith$Query$TorrentTotalStats$torrentDaemon(
Query$TorrentTotalStats$torrentDaemon instance,
TRes Function(Query$TorrentTotalStats$torrentDaemon) then,
) = _CopyWithImpl$Query$TorrentTotalStats$torrentDaemon;
factory CopyWith$Query$TorrentTotalStats$torrentDaemon.stub(TRes res) =
_CopyWithStubImpl$Query$TorrentTotalStats$torrentDaemon;
TRes call({
List<Query$TorrentTotalStats$torrentDaemon$statsHistory>? statsHistory,
String? $__typename,
});
TRes statsHistory(
Iterable<Query$TorrentTotalStats$torrentDaemon$statsHistory> Function(
Iterable<
CopyWith$Query$TorrentTotalStats$torrentDaemon$statsHistory<
Query$TorrentTotalStats$torrentDaemon$statsHistory>>)
_fn);
}
class _CopyWithImpl$Query$TorrentTotalStats$torrentDaemon<TRes>
implements CopyWith$Query$TorrentTotalStats$torrentDaemon<TRes> {
_CopyWithImpl$Query$TorrentTotalStats$torrentDaemon(
this._instance,
this._then,
);
final Query$TorrentTotalStats$torrentDaemon _instance;
final TRes Function(Query$TorrentTotalStats$torrentDaemon) _then;
static const _undefined = <dynamic, dynamic>{};
TRes call({
Object? statsHistory = _undefined,
Object? $__typename = _undefined,
}) =>
_then(Query$TorrentTotalStats$torrentDaemon(
statsHistory: statsHistory == _undefined || statsHistory == null
? _instance.statsHistory
: (statsHistory
as List<Query$TorrentTotalStats$torrentDaemon$statsHistory>),
$__typename: $__typename == _undefined || $__typename == null
? _instance.$__typename
: ($__typename as String),
));
TRes statsHistory(
Iterable<Query$TorrentTotalStats$torrentDaemon$statsHistory> Function(
Iterable<
CopyWith$Query$TorrentTotalStats$torrentDaemon$statsHistory<
Query$TorrentTotalStats$torrentDaemon$statsHistory>>)
_fn) =>
call(
statsHistory: _fn(_instance.statsHistory.map((e) =>
CopyWith$Query$TorrentTotalStats$torrentDaemon$statsHistory(
e,
(i) => i,
))).toList());
}
class _CopyWithStubImpl$Query$TorrentTotalStats$torrentDaemon<TRes>
implements CopyWith$Query$TorrentTotalStats$torrentDaemon<TRes> {
_CopyWithStubImpl$Query$TorrentTotalStats$torrentDaemon(this._res);
TRes _res;
call({
List<Query$TorrentTotalStats$torrentDaemon$statsHistory>? statsHistory,
String? $__typename,
}) =>
_res;
statsHistory(_fn) => _res;
}
class Query$TorrentTotalStats$torrentDaemon$statsHistory {
Query$TorrentTotalStats$torrentDaemon$statsHistory({
required this.timestamp,
required this.downloadedBytes,
required this.uploadedBytes,
required this.totalPeers,
required this.activePeers,
required this.connectedSeeders,
this.$__typename = 'TorrentStats',
});
factory Query$TorrentTotalStats$torrentDaemon$statsHistory.fromJson(
Map<String, dynamic> json) {
final l$timestamp = json['timestamp'];
final l$downloadedBytes = json['downloadedBytes'];
final l$uploadedBytes = json['uploadedBytes'];
final l$totalPeers = json['totalPeers'];
final l$activePeers = json['activePeers'];
final l$connectedSeeders = json['connectedSeeders'];
final l$$__typename = json['__typename'];
return Query$TorrentTotalStats$torrentDaemon$statsHistory(
timestamp: DateTime.parse((l$timestamp as String)),
downloadedBytes: (l$downloadedBytes as int),
uploadedBytes: (l$uploadedBytes as int),
totalPeers: (l$totalPeers as int),
activePeers: (l$activePeers as int),
connectedSeeders: (l$connectedSeeders as int),
$__typename: (l$$__typename as String),
);
}
final DateTime timestamp;
final int downloadedBytes;
final int uploadedBytes;
final int totalPeers;
final int activePeers;
final int connectedSeeders;
final String $__typename;
Map<String, dynamic> toJson() {
final _resultData = <String, dynamic>{};
final l$timestamp = timestamp;
_resultData['timestamp'] = l$timestamp.toIso8601String();
final l$downloadedBytes = downloadedBytes;
_resultData['downloadedBytes'] = l$downloadedBytes;
final l$uploadedBytes = uploadedBytes;
_resultData['uploadedBytes'] = l$uploadedBytes;
final l$totalPeers = totalPeers;
_resultData['totalPeers'] = l$totalPeers;
final l$activePeers = activePeers;
_resultData['activePeers'] = l$activePeers;
final l$connectedSeeders = connectedSeeders;
_resultData['connectedSeeders'] = l$connectedSeeders;
final l$$__typename = $__typename;
_resultData['__typename'] = l$$__typename;
return _resultData;
}
@override
int get hashCode {
final l$timestamp = timestamp;
final l$downloadedBytes = downloadedBytes;
final l$uploadedBytes = uploadedBytes;
final l$totalPeers = totalPeers;
final l$activePeers = activePeers;
final l$connectedSeeders = connectedSeeders;
final l$$__typename = $__typename;
return Object.hashAll([
l$timestamp,
l$downloadedBytes,
l$uploadedBytes,
l$totalPeers,
l$activePeers,
l$connectedSeeders,
l$$__typename,
]);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (!(other is Query$TorrentTotalStats$torrentDaemon$statsHistory) ||
runtimeType != other.runtimeType) {
return false;
}
final l$timestamp = timestamp;
final lOther$timestamp = other.timestamp;
if (l$timestamp != lOther$timestamp) {
return false;
}
final l$downloadedBytes = downloadedBytes;
final lOther$downloadedBytes = other.downloadedBytes;
if (l$downloadedBytes != lOther$downloadedBytes) {
return false;
}
final l$uploadedBytes = uploadedBytes;
final lOther$uploadedBytes = other.uploadedBytes;
if (l$uploadedBytes != lOther$uploadedBytes) {
return false;
}
final l$totalPeers = totalPeers;
final lOther$totalPeers = other.totalPeers;
if (l$totalPeers != lOther$totalPeers) {
return false;
}
final l$activePeers = activePeers;
final lOther$activePeers = other.activePeers;
if (l$activePeers != lOther$activePeers) {
return false;
}
final l$connectedSeeders = connectedSeeders;
final lOther$connectedSeeders = other.connectedSeeders;
if (l$connectedSeeders != lOther$connectedSeeders) {
return false;
}
final l$$__typename = $__typename;
final lOther$$__typename = other.$__typename;
if (l$$__typename != lOther$$__typename) {
return false;
}
return true;
}
}
extension UtilityExtension$Query$TorrentTotalStats$torrentDaemon$statsHistory
on Query$TorrentTotalStats$torrentDaemon$statsHistory {
CopyWith$Query$TorrentTotalStats$torrentDaemon$statsHistory<
Query$TorrentTotalStats$torrentDaemon$statsHistory>
get copyWith =>
CopyWith$Query$TorrentTotalStats$torrentDaemon$statsHistory(
this,
(i) => i,
);
}
abstract class CopyWith$Query$TorrentTotalStats$torrentDaemon$statsHistory<
TRes> {
factory CopyWith$Query$TorrentTotalStats$torrentDaemon$statsHistory(
Query$TorrentTotalStats$torrentDaemon$statsHistory instance,
TRes Function(Query$TorrentTotalStats$torrentDaemon$statsHistory) then,
) = _CopyWithImpl$Query$TorrentTotalStats$torrentDaemon$statsHistory;
factory CopyWith$Query$TorrentTotalStats$torrentDaemon$statsHistory.stub(
TRes res) =
_CopyWithStubImpl$Query$TorrentTotalStats$torrentDaemon$statsHistory;
TRes call({
DateTime? timestamp,
int? downloadedBytes,
int? uploadedBytes,
int? totalPeers,
int? activePeers,
int? connectedSeeders,
String? $__typename,
});
}
class _CopyWithImpl$Query$TorrentTotalStats$torrentDaemon$statsHistory<TRes>
implements
CopyWith$Query$TorrentTotalStats$torrentDaemon$statsHistory<TRes> {
_CopyWithImpl$Query$TorrentTotalStats$torrentDaemon$statsHistory(
this._instance,
this._then,
);
final Query$TorrentTotalStats$torrentDaemon$statsHistory _instance;
final TRes Function(Query$TorrentTotalStats$torrentDaemon$statsHistory) _then;
static const _undefined = <dynamic, dynamic>{};
TRes call({
Object? timestamp = _undefined,
Object? downloadedBytes = _undefined,
Object? uploadedBytes = _undefined,
Object? totalPeers = _undefined,
Object? activePeers = _undefined,
Object? connectedSeeders = _undefined,
Object? $__typename = _undefined,
}) =>
_then(Query$TorrentTotalStats$torrentDaemon$statsHistory(
timestamp: timestamp == _undefined || timestamp == null
? _instance.timestamp
: (timestamp as DateTime),
downloadedBytes:
downloadedBytes == _undefined || downloadedBytes == null
? _instance.downloadedBytes
: (downloadedBytes as int),
uploadedBytes: uploadedBytes == _undefined || uploadedBytes == null
? _instance.uploadedBytes
: (uploadedBytes as int),
totalPeers: totalPeers == _undefined || totalPeers == null
? _instance.totalPeers
: (totalPeers as int),
activePeers: activePeers == _undefined || activePeers == null
? _instance.activePeers
: (activePeers as int),
connectedSeeders:
connectedSeeders == _undefined || connectedSeeders == null
? _instance.connectedSeeders
: (connectedSeeders as int),
$__typename: $__typename == _undefined || $__typename == null
? _instance.$__typename
: ($__typename as String),
));
}
class _CopyWithStubImpl$Query$TorrentTotalStats$torrentDaemon$statsHistory<TRes>
implements
CopyWith$Query$TorrentTotalStats$torrentDaemon$statsHistory<TRes> {
_CopyWithStubImpl$Query$TorrentTotalStats$torrentDaemon$statsHistory(
this._res);
TRes _res;
call({
DateTime? timestamp,
int? downloadedBytes,
int? uploadedBytes,
int? totalPeers,
int? activePeers,
int? connectedSeeders,
String? $__typename,
}) =>
_res;
}

View file

@ -20,10 +20,10 @@ class _DownloadsScreenState extends State<DownloadsScreen> {
child: FutureBuilder(
key: GlobalKey(),
future: client.query$ListTorrents(Options$Query$ListTorrents(
variables: Variables$Query$ListTorrents(downloading: filterDownloading),
)),
// variables: Variables$Query$ListTorrents(downloading: filterDownloading),
)),
builder: (context, snapshot) {
final torrents = snapshot.data?.parsedData?.torrents;
final torrents = snapshot.data?.parsedData?.torrentDaemon?.torrents;
return NestedScrollView(
floatHeaderSlivers: true,
@ -68,7 +68,7 @@ class _DownloadsScreenState extends State<DownloadsScreen> {
}
class TorrentTile extends StatelessWidget {
final Query$ListTorrents$torrents torrent;
final Query$ListTorrents$torrentDaemon$torrents torrent;
const TorrentTile({super.key, required this.torrent});

View file

@ -9,6 +9,7 @@ import 'package:tstor_ui/components/sliver_header.dart';
import 'package:tstor_ui/font/t_icons_icons.dart';
import 'package:path/path.dart' as p;
import 'package:tstor_ui/screens/torrent_stats.dart';
import 'package:tstor_ui/utils/bytes.dart';
class FileViewScreen extends StatefulWidget {
@ -88,6 +89,13 @@ class _FileViewScreenState extends State<FileViewScreen> {
icon: const Icon(Icons.arrow_upward),
),
actions: [
IconButton(
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (context) => const TorrentStatsScreen()),
),
icon: const Icon(Icons.trending_up),
),
IconButton(
icon: const Icon(Icons.refresh),
onPressed: refresh,

View file

@ -0,0 +1,62 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:graphql/client.dart';
import 'package:tstor_ui/api/client.dart';
import 'package:tstor_ui/api/torrent_stats.graphql.dart';
class TorrentStatsScreen extends StatefulWidget {
const TorrentStatsScreen({super.key});
@override
State<TorrentStatsScreen> createState() => _TorrentStatsScreenState();
}
class _TorrentStatsScreenState extends State<TorrentStatsScreen> {
Future<LineChartData> _totalStats() async {
final since = DateTime.now().subtract(Duration(hours: 1));
final data = await client.query$TorrentTotalStats(
Options$Query$TorrentTotalStats(
variables: Variables$Query$TorrentTotalStats(
since: since,
),
fetchPolicy: FetchPolicy.networkOnly,
),
);
return LineChartData(
lineBarsData: [
LineChartBarData(
spots: data.parsedData!.torrentDaemon!.statsHistory
.map(
(e) => FlSpot(
since.difference(e.timestamp).inSeconds.toDouble(),
e.activePeers.toDouble(),
),
)
.toList(),
),
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Torrent Stats"),
),
body: FutureBuilder(
future: _totalStats(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return const Center(
child: CircularProgressIndicator(),
);
}
return LineChart(snapshot.data!);
},
),
);
}
}

View file

@ -10,7 +10,7 @@ import dynamic_color
import path_provider_foundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
}

View file

@ -5,18 +5,23 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7"
sha256: "5aaf60d96c4cd00fe7f21594b5ad6a1b699c80a27420f8a837f4d68473ef09e3"
url: "https://pub.dev"
source: hosted
version: "67.0.0"
version: "68.0.0"
_macros:
dependency: transitive
description: dart
source: sdk
version: "0.1.5"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
sha256: "21f1d3720fd1c70316399d5e2bccaebb415c434592d778cce8acb967b8578808"
url: "https://pub.dev"
source: hosted
version: "6.4.1"
version: "6.5.0"
args:
dependency: transitive
description:
@ -61,10 +66,10 @@ packages:
dependency: transitive
description:
name: build_daemon
sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1"
sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9"
url: "https://pub.dev"
source: hosted
version: "4.0.1"
version: "4.0.2"
build_resolvers:
dependency: transitive
description:
@ -77,18 +82,18 @@ packages:
dependency: "direct dev"
description:
name: build_runner
sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22"
sha256: "644dc98a0f179b872f612d3eb627924b578897c629788e858157fa5e704ca0c7"
url: "https://pub.dev"
source: hosted
version: "2.4.9"
version: "2.4.11"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799"
sha256: e3c79f69a64bdfcd8a776a3c28db4eb6e3fb5356d013ae5eb2e52007706d5dbe
url: "https://pub.dev"
source: hosted
version: "7.3.0"
version: "7.3.1"
built_collection:
dependency: transitive
description:
@ -149,18 +154,18 @@ packages:
dependency: transitive
description:
name: connectivity_plus
sha256: "224a77051d52a11fbad53dd57827594d3bd24f945af28bd70bab376d68d437f0"
sha256: db7a4e143dc72cc3cb2044ef9b052a7ebfe729513e6a82943bc3526f784365b8
url: "https://pub.dev"
source: hosted
version: "5.0.2"
version: "6.0.3"
connectivity_plus_platform_interface:
dependency: transitive
description:
name: connectivity_plus_platform_interface
sha256: cf1d1c28f4416f8c654d7dc3cd638ec586076255d407cef3ddbdaf178272a71a
sha256: b6a56efe1e6675be240de39107281d4034b64ac23438026355b4234042a35adb
url: "https://pub.dev"
source: hosted
version: "1.2.4"
version: "2.0.0"
convert:
dependency: transitive
description:
@ -209,6 +214,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.7.0"
equatable:
dependency: transitive
description:
name: equatable
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
url: "https://pub.dev"
source: hosted
version: "2.0.5"
fake_async:
dependency: transitive
description:
@ -241,6 +254,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.0"
fl_chart:
dependency: "direct main"
description:
name: fl_chart
sha256: d0f0d49112f2f4b192481c16d05b6418bd7820e021e265a3c22db98acf7ed7fb
url: "https://pub.dev"
source: hosted
version: "0.68.0"
flutter:
dependency: "direct main"
description: flutter
@ -258,10 +279,10 @@ packages:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "4.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
@ -292,10 +313,10 @@ packages:
dependency: "direct main"
description:
name: gql
sha256: afe032332ddfa69b79f1dea2ad7d95923d4993c1b269b224fc7bb3d17e32d33c
sha256: "8ecd3585bb9e40d671aa58f52575d950670f99e5ffab18e2b34a757e071a6693"
url: "https://pub.dev"
source: hosted
version: "1.0.1-alpha+1709845491443"
version: "1.0.1-alpha+1717789143880"
gql_code_builder:
dependency: transitive
description:
@ -308,10 +329,10 @@ packages:
dependency: transitive
description:
name: gql_dedupe_link
sha256: "2971173c68623d5c43f5327ea899bd2ee64ce3461c1263f240b4bb6211f667be"
sha256: "10bee0564d67c24e0c8bd08bd56e0682b64a135e58afabbeed30d85d5e9fea96"
url: "https://pub.dev"
source: hosted
version: "2.0.4-alpha+1709845491527"
version: "2.0.4-alpha+1715521079596"
gql_error_link:
dependency: transitive
description:
@ -332,18 +353,18 @@ packages:
dependency: transitive
description:
name: gql_http_link
sha256: "1f922eed1b7078fdbfd602187663026f9f659fe9a9499e2207b5d5e01617f658"
sha256: ef6ad24d31beb5a30113e9b919eec20876903cc4b0ee0d31550047aaaba7d5dd
url: "https://pub.dev"
source: hosted
version: "1.0.1+1"
version: "1.1.0"
gql_link:
dependency: transitive
description:
name: gql_link
sha256: "177500e250b3742d6d2673d57961e8413b6593dc6bd6a512c51865b6cf096f7e"
sha256: "70fd5b5cbcc50601679f4b9fea3bcc994e583f59cfec7e1fec11113074b1a565"
url: "https://pub.dev"
source: hosted
version: "1.0.1-alpha+1709845491457"
version: "1.0.1-alpha+1717789143896"
gql_transform_link:
dependency: transitive
description:
@ -364,10 +385,10 @@ packages:
dependency: "direct main"
description:
name: graphql
sha256: d066e53446166c12537458386b507f7426f2b8801ebafc184576aab3cbc64d56
sha256: "62f31433ba194eda7b81a812a83c3d9560766cec5ac0210ea4a3e677c91b8df4"
url: "https://pub.dev"
source: hosted
version: "5.2.0-beta.7"
version: "5.2.0-beta.8"
graphql_codegen:
dependency: "direct dev"
description:
@ -380,10 +401,10 @@ packages:
dependency: "direct main"
description:
name: graphql_flutter
sha256: "39b5e830bc654ab02c5b776c31675841d1a8c95840fdd284efba713b1d47e65d"
sha256: "2423b394465e7d83a5e708cd2f5b37b54e7ae9900abfbf0948d512fa46961acb"
url: "https://pub.dev"
source: hosted
version: "5.2.0-beta.6"
version: "5.2.0-beta.7"
graphs:
dependency: transitive
description:
@ -404,10 +425,10 @@ packages:
dependency: transitive
description:
name: http
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010
url: "https://pub.dev"
source: hosted
version: "1.2.1"
version: "1.2.2"
http_multi_server:
dependency: transitive
description:
@ -436,34 +457,34 @@ packages:
dependency: transitive
description:
name: js
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
url: "https://pub.dev"
source: hosted
version: "0.6.7"
version: "0.7.1"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
url: "https://pub.dev"
source: hosted
version: "4.8.1"
version: "4.9.0"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
version: "10.0.5"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
version: "3.0.5"
leak_tracker_testing:
dependency: transitive
description:
@ -476,10 +497,10 @@ packages:
dependency: transitive
description:
name: lints
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
version: "4.0.0"
logging:
dependency: transitive
description:
@ -488,6 +509,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
macros:
dependency: transitive
description:
name: macros
sha256: a8403c89b36483b4cbf9f1fcd24562f483cb34a5c9bf101cf2b0d8a083cf1239
url: "https://pub.dev"
source: hosted
version: "0.1.0-main.5"
matcher:
dependency: transitive
description:
@ -500,18 +529,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
version: "0.8.0"
version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
sha256: "25dfcaf170a0190f47ca6355bdd4552cb8924b430512ff0cafb8db9bd41fe33b"
url: "https://pub.dev"
source: hosted
version: "1.12.0"
version: "1.14.0"
mime:
dependency: transitive
description:
@ -572,18 +601,18 @@ packages:
dependency: transitive
description:
name: path_provider_android
sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d
sha256: "30c5aa827a6ae95ce2853cdc5fe3971daaac00f6f081c419c013f7f57bff2f5e"
url: "https://pub.dev"
source: hosted
version: "2.2.4"
version: "2.2.7"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f"
sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16
url: "https://pub.dev"
source: hosted
version: "2.3.2"
version: "2.4.0"
path_provider_linux:
dependency: transitive
description:
@ -604,10 +633,10 @@ packages:
dependency: transitive
description:
name: path_provider_windows
sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7
url: "https://pub.dev"
source: hosted
version: "2.2.1"
version: "2.3.0"
petitparser:
dependency: transitive
description:
@ -620,10 +649,10 @@ packages:
dependency: transitive
description:
name: platform
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
url: "https://pub.dev"
source: hosted
version: "3.1.4"
version: "3.1.5"
plugin_platform_interface:
dependency: transitive
description:
@ -660,10 +689,10 @@ packages:
dependency: transitive
description:
name: pubspec_parse
sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367
sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8
url: "https://pub.dev"
source: hosted
version: "1.2.3"
version: "1.3.0"
recase:
dependency: transitive
description:
@ -692,10 +721,10 @@ packages:
dependency: transitive
description:
name: shelf_web_socket
sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611"
url: "https://pub.dev"
source: hosted
version: "1.0.4"
version: "2.0.0"
sky_engine:
dependency: transitive
description: flutter
@ -761,10 +790,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
sha256: "2419f20b0c8677b2d67c8ac4d1ac7372d862dc6c460cdbb052b40155408cd794"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
version: "0.7.1"
timing:
dependency: transitive
description:
@ -785,10 +814,10 @@ packages:
dependency: transitive
description:
name: uuid
sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8"
sha256: "83d37c7ad7aaf9aa8e275490669535c8080377cfa7a7004c24dfac53afffaa90"
url: "https://pub.dev"
source: hosted
version: "4.4.0"
version: "4.4.2"
vector_math:
dependency: transitive
description:
@ -801,10 +830,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: a75f83f14ad81d5fe4b3319710b90dec37da0e22612326b696c9e1b8f34bbf48
sha256: "7475cb4dd713d57b6f7464c0e13f06da0d535d8b2067e188962a59bac2cf280b"
url: "https://pub.dev"
source: hosted
version: "14.2.0"
version: "14.2.2"
watcher:
dependency: transitive
description:
@ -825,18 +854,10 @@ packages:
dependency: transitive
description:
name: web_socket_channel
sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42"
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
url: "https://pub.dev"
source: hosted
version: "2.4.5"
win32:
dependency: transitive
description:
name: win32
sha256: "0a989dc7ca2bb51eac91e8fd00851297cfffd641aa7538b165c62637ca0eaa4a"
url: "https://pub.dev"
source: hosted
version: "5.4.0"
version: "2.4.0"
xdg_directories:
dependency: transitive
description:
@ -862,5 +883,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.4.0-282.1.beta <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
dart: ">=3.4.0 <4.0.0"
flutter: ">=3.22.0"

View file

@ -38,11 +38,12 @@ dependencies:
path: any
dynamic_color: ^1.7.0
fl_chart: ^0.68.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.0
flutter_lints: ^4.0.0
build_runner: ^2.4.9
graphql_codegen: ^0.14.0