1
0
mirror of https://github.com/flutter/samples.git synced 2026-03-30 16:23:23 +00:00

web/github_dataviz: Migrate to null safety (#919)

This commit is contained in:
Brett Morgan
2021-10-08 19:43:25 +11:00
committed by GitHub
parent 8932e60976
commit 83d3ea99f0
12 changed files with 183 additions and 144 deletions

View File

@@ -1,8 +1,8 @@
import 'package:github_dataviz/mathutils.dart';
class ControlPointAndValue {
int point;
double value;
late int point;
double? value;
ControlPointAndValue() {
value = 0;
@@ -37,9 +37,9 @@ class CatmullInterpolator implements Interpolator {
}
ControlPointAndValue progressiveGet(ControlPointAndValue cpv) {
double v = cpv.value;
double? v = cpv.value;
for (int i = cpv.point; i < controlPoints.length - 1; i++) {
if (controlPoints[i].x >= v) {
if (controlPoints[i].x >= v!) {
double t = (v - controlPoints[i - 1].x) /
(controlPoints[i].x - controlPoints[i - 1].x);
double p0 = controlPoints[i - 2].y;