wip: null safety

upgrade-2021-project
Stefan Haslinger 2022-03-11 11:38:19 +01:00
parent c7c747ee78
commit eebf5d5882
7 changed files with 20 additions and 20 deletions

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,7 @@ class CriticalPower extends PowerDuration {
});
plotPoints.sort((DoublePlotPoint a, DoublePlotPoint b) =>
a.domain!.compareTo(b.domain!));
a.domain.compareTo(b.domain));
return plotPoints;
}

View File

@ -46,7 +46,7 @@ class MinimumPowerDuration {
});
plotPoints
.sort((IntPlotPoint a, IntPlotPoint b) => a.domain!.compareTo(b.domain!));
.sort((IntPlotPoint a, IntPlotPoint b) => a.domain.compareTo(b.domain));
return plotPoints;
}

View File

@ -1,28 +1,28 @@
class IntPlotPoint {
IntPlotPoint({this.domain, this.measure});
IntPlotPoint({required this.domain, required this.measure});
int? domain;
int? measure;
int domain;
int measure;
@override
String toString() => '< IntPlotPoint | $domain | $measure >';
}
class DoublePlotPoint {
DoublePlotPoint({this.domain, this.measure});
DoublePlotPoint({required this.domain, required this.measure});
int? domain;
double? measure;
int domain;
double measure;
@override
String toString() => '< DoublePlotPoint | $domain | $measure >';
}
class EnergyPoint {
EnergyPoint({this.energy, this.duration});
EnergyPoint({required this.energy, required this.duration});
int? energy;
int? duration;
int energy;
int duration;
@override
String toString() => '< EnergyPlotPoint | $energy | $duration >';

View File

@ -14,8 +14,8 @@ class PowerDuration {
.inSeconds;
powerSum.forEach((int start, EnergyPoint energyPoint) {
final int newEnergy = energyPoint.energy! + power * duration;
final int newDuration = energyPoint.duration! + duration;
final int newEnergy = energyPoint.energy + power * duration;
final int newDuration = energyPoint.duration + duration;
powerSum[start] = EnergyPoint(
energy: newEnergy,
@ -64,7 +64,7 @@ class PowerDuration {
});
plotPoints.sort(
(DoublePlotPoint a, DoublePlotPoint b) => a.domain!.compareTo(b.domain!));
(DoublePlotPoint a, DoublePlotPoint b) => a.domain.compareTo(b.domain));
return plotPoints;
}

View File

@ -31,8 +31,8 @@ class ActivityHeartRateChart extends StatelessWidget {
amount: athlete!.recordAggregationCount,
);
final List<Series<IntPlotPoint, int?>> data = <Series<IntPlotPoint, int?>>[
Series<IntPlotPoint, int?>(
final List<Series<IntPlotPoint, int>> data = <Series<IntPlotPoint, int>>[
Series<IntPlotPoint, int>(
id: 'Heart Rate',
colorFn: (_, __) => Color.black,
domainFn: (IntPlotPoint point, _) => point.domain,

View File

@ -32,9 +32,9 @@ class ActivityVerticalOscillationChart extends StatelessWidget {
amount: athlete!.recordAggregationCount,
);
final List<Series<DoublePlotPoint, int?>> data =
<Series<DoublePlotPoint, int?>>[
Series<DoublePlotPoint, int?>(
final List<Series<DoublePlotPoint, int>> data =
<Series<DoublePlotPoint, int>>[
Series<DoublePlotPoint, int>(
id: 'Vertical Oscillation',
colorFn: (_, __) => Color.black,
domainFn: (DoublePlotPoint record, _) => record.domain,