Unverified Commit 734a90eb authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

migrate semantics to nullsafety (#64055)

parent 6ca9cd7b
...@@ -7,5 +7,6 @@ analyzer: ...@@ -7,5 +7,6 @@ analyzer:
- non-nullable - non-nullable
errors: errors:
always_require_non_null_named_parameters: false # not needed with nnbd always_require_non_null_named_parameters: false # not needed with nnbd
type_init_formals: false # https://github.com/dart-lang/linter/issues/2192
void_checks: false # https://github.com/dart-lang/linter/issues/2185 void_checks: false # https://github.com/dart-lang/linter/issues/2185
unnecessary_null_comparison: false # https://github.com/dart-lang/language/issues/1018 , turned off until https://github.com/flutter/flutter/issues/61042 unnecessary_null_comparison: false # https://github.com/dart-lang/language/issues/1018 , turned off until https://github.com/flutter/flutter/issues/61042
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
/// The Flutter semantics package. /// The Flutter semantics package.
/// ///
/// To use, import `package:flutter/semantics.dart`. /// To use, import `package:flutter/semantics.dart`.
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:ui' as ui show AccessibilityFeatures, SemanticsUpdateBuilder; import 'dart:ui' as ui show AccessibilityFeatures, SemanticsUpdateBuilder;
...@@ -16,8 +15,8 @@ export 'dart:ui' show AccessibilityFeatures; ...@@ -16,8 +15,8 @@ export 'dart:ui' show AccessibilityFeatures;
// TODO(jonahwilliams): move the remaining semantic related bindings here. // TODO(jonahwilliams): move the remaining semantic related bindings here.
mixin SemanticsBinding on BindingBase { mixin SemanticsBinding on BindingBase {
/// The current [SemanticsBinding], if one has been created. /// The current [SemanticsBinding], if one has been created.
static SemanticsBinding get instance => _instance; static SemanticsBinding? get instance => _instance;
static SemanticsBinding _instance; static SemanticsBinding? _instance;
@override @override
void initInstances() { void initInstances() {
...@@ -53,7 +52,7 @@ mixin SemanticsBinding on BindingBase { ...@@ -53,7 +52,7 @@ mixin SemanticsBinding on BindingBase {
/// [WidgetsBindingObserver] and listen to /// [WidgetsBindingObserver] and listen to
/// [WidgetsBindingObserver.didChangeAccessibilityFeatures]. /// [WidgetsBindingObserver.didChangeAccessibilityFeatures].
ui.AccessibilityFeatures get accessibilityFeatures => _accessibilityFeatures; ui.AccessibilityFeatures get accessibilityFeatures => _accessibilityFeatures;
ui.AccessibilityFeatures _accessibilityFeatures; late ui.AccessibilityFeatures _accessibilityFeatures;
/// The platform is requesting that animations be disabled or simplified. /// The platform is requesting that animations be disabled or simplified.
/// ///
...@@ -63,7 +62,7 @@ mixin SemanticsBinding on BindingBase { ...@@ -63,7 +62,7 @@ mixin SemanticsBinding on BindingBase {
bool value = _accessibilityFeatures.disableAnimations; bool value = _accessibilityFeatures.disableAnimations;
assert(() { assert(() {
if (debugSemanticsDisableAnimations != null) if (debugSemanticsDisableAnimations != null)
value = debugSemanticsDisableAnimations; value = debugSemanticsDisableAnimations!;
return true; return true;
}()); }());
return value; return value;
......
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
/// Overrides the setting of [SemanticsBinding.disableAnimations] for debugging /// Overrides the setting of [SemanticsBinding.disableAnimations] for debugging
/// and testing. /// and testing.
/// ///
/// This value is ignored in non-debug builds. /// This value is ignored in non-debug builds.
bool debugSemanticsDisableAnimations; bool? debugSemanticsDisableAnimations;
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
...@@ -30,7 +29,7 @@ abstract class SemanticsEvent { ...@@ -30,7 +29,7 @@ abstract class SemanticsEvent {
/// ///
/// [nodeId] is the unique identifier of the semantics node associated with /// [nodeId] is the unique identifier of the semantics node associated with
/// the event, or null if the event is not associated with a semantics node. /// the event, or null if the event is not associated with a semantics node.
Map<String, dynamic> toMap({ int nodeId }) { Map<String, dynamic> toMap({ int? nodeId }) {
final Map<String, dynamic> event = <String, dynamic>{ final Map<String, dynamic> event = <String, dynamic>{
'type': type, 'type': type,
'data': getDataMap(), 'data': getDataMap(),
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'dart:ui' show TextDirection; import 'dart:ui' show TextDirection;
......
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