Unverified Commit a07219a3 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

migrate physics to nullsafety (#61941)

parent b50b5ead
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
/// Simple one-dimensional physics simulations, such as springs, friction, and
/// gravity, for use in user interface animations.
///
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'simulation.dart';
/// A simulation that applies limits to another simulation.
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'dart:math' as math;
import 'simulation.dart';
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'simulation.dart';
// Examples can assume:
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/foundation.dart';
import 'tolerance.dart';
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'dart:math' as math;
import 'package:flutter/foundation.dart';
......@@ -20,9 +18,9 @@ class SpringDescription {
///
/// See [mass], [stiffness], and [damping] for the units of the arguments.
const SpringDescription({
this.mass,
this.stiffness,
this.damping,
required this.mass,
required this.stiffness,
required this.damping,
});
/// Creates a spring given the mass (m), stiffness (k), and damping ratio (ζ).
......@@ -33,8 +31,8 @@ class SpringDescription {
/// See [mass] and [stiffness] for the units for those arguments. The damping
/// ratio is unitless.
SpringDescription.withDampingRatio({
this.mass,
this.stiffness,
required this.mass,
required this.stiffness,
double ratio = 1.0,
}) : damping = ratio * 2.0 * math.sqrt(mass * stiffness);
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
/// Structure that specifies maximum allowable magnitudes for distances,
/// durations, and velocity differences to be considered equal.
class Tolerance {
......
......@@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
/// Whether two doubles are within a given distance of each other.
///
/// The `epsilon` argument must be positive and not null.
/// The `a` and `b` arguments may be null. A null value is only considered
/// near-equal to another null value.
bool nearEqual(double a, double b, double epsilon) {
bool nearEqual(double? a, double? b, double epsilon) {
assert(epsilon != null);
assert(epsilon >= 0.0);
if (a == null || b == null)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment