Fix warnings for non-nullable bindings (#1972)
* Fix warnings for non-nullable bindings
* Update CHANGELOG.md
* Update null_safe_test.dart
* format
* Update main.dart
* address feedback
* x
* address feedback
* undo auto formatting
* x
* fix formatting
* add missing `lcov_parser` dev dependency
diff --git a/packages/animations/CHANGELOG.md b/packages/animations/CHANGELOG.md
index 21ccdb7..6fa3537 100644
--- a/packages/animations/CHANGELOG.md
+++ b/packages/animations/CHANGELOG.md
@@ -1,3 +1,6 @@
+## 2.0.3
+* Updates for non-nullable bindings.
+
## 2.0.2
* Fixed documentation for `OpenContainer` class; replaced `openBuilder` with `closedBuilder`.
diff --git a/packages/animations/lib/src/open_container.dart b/packages/animations/lib/src/open_container.dart
index 67ec13e..a3a3c72 100644
--- a/packages/animations/lib/src/open_container.dart
+++ b/packages/animations/lib/src/open_container.dart
@@ -628,7 +628,7 @@
if (hideableKey.currentState?.isVisible == false) {
// This route may be disposed without dismissing its animation if it is
// removed by the navigator.
- _ambiguate(SchedulerBinding.instance)!
+ SchedulerBinding.instance
.addPostFrameCallback((Duration d) => _toggleHideable(hide: false));
}
super.dispose();
@@ -662,7 +662,7 @@
}
if (delayForSourceRoute) {
- _ambiguate(SchedulerBinding.instance)!
+ SchedulerBinding.instance
.addPostFrameCallback(takeMeasurementsInSourceRoute);
} else {
takeMeasurementsInSourceRoute();
@@ -901,11 +901,3 @@
return _flipped;
}
}
-
-/// This allows a value of type T or T? to be treated as a value of type T?.
-///
-/// We use this so that APIs that have become non-nullable can still be used
-/// with `!` and `?` on the stable branch.
-// TODO(ianh): Remove this once the relevant APIs have shipped to stable.
-// See https://github.com/flutter/flutter/issues/64830
-T? _ambiguate<T>(T? value) => value;
diff --git a/packages/animations/pubspec.yaml b/packages/animations/pubspec.yaml
index ab7ef6d..56a4bea 100644
--- a/packages/animations/pubspec.yaml
+++ b/packages/animations/pubspec.yaml
@@ -2,10 +2,11 @@
description: Fancy pre-built animations that can easily be integrated into any Flutter application.
repository: https://github.com/flutter/packages/tree/main/packages/animations
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+animations%22
-version: 2.0.2
+version: 2.0.3
environment:
sdk: '>=2.12.0 <3.0.0'
+ flutter: ">=3.0.0"
dependencies:
flutter:
diff --git a/packages/flutter_image/CHANGELOG.md b/packages/flutter_image/CHANGELOG.md
index a485636..466139a 100644
--- a/packages/flutter_image/CHANGELOG.md
+++ b/packages/flutter_image/CHANGELOG.md
@@ -1,6 +1,7 @@
-## NEXT
+## 4.1.1
-- Updates package description.
+* Updates package description.
+* Updates for non-nullable bindings.
## 4.1.0
diff --git a/packages/flutter_image/pubspec.yaml b/packages/flutter_image/pubspec.yaml
index 59d2094..05cc9a3 100644
--- a/packages/flutter_image/pubspec.yaml
+++ b/packages/flutter_image/pubspec.yaml
@@ -3,11 +3,11 @@
Image utilities for Flutter: improved network providers, effects, etc.
repository: https://github.com/flutter/packages/tree/main/packages/flutter_image
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_image%22
-version: 4.1.0
+version: 4.1.1
environment:
sdk: ">=2.12.0 <3.0.0"
- flutter: ">=1.10.15-pre.144"
+ flutter: ">=3.0.0"
dependencies:
flutter:
diff --git a/packages/flutter_image/test/network_test.dart b/packages/flutter_image/test/network_test.dart
index 10a5727..187688f 100644
--- a/packages/flutter_image/test/network_test.dart
+++ b/packages/flutter_image/test/network_test.dart
@@ -142,7 +142,7 @@
) {
final ImageStreamCompleter completer = subject.load(
subject,
- _ambiguate(PaintingBinding.instance)!.instantiateImageCodec,
+ PaintingBinding.instance.instantiateImageCodec,
);
completer.addListener(ImageStreamListener(
(ImageInfo image, bool synchronousCall) {},
@@ -159,7 +159,7 @@
) {
final ImageStreamCompleter completer = subject.load(
subject,
- _ambiguate(PaintingBinding.instance)!.instantiateImageCodec,
+ PaintingBinding.instance.instantiateImageCodec,
);
completer.addListener(ImageStreamListener(
expectAsync2((ImageInfo image, bool synchronousCall) {
@@ -168,11 +168,3 @@
}),
));
}
-
-/// This allows a value of type T or T? to be treated as a value of type T?.
-///
-/// We use this so that APIs that have become non-nullable can still be used
-/// with `!` and `?` on the stable branch.
-// TODO(ianh): Remove this once the relevant APIs have shipped to stable.
-// See https://github.com/flutter/flutter/issues/64830
-T? _ambiguate<T>(T? value) => value;
diff --git a/packages/flutter_markdown/CHANGELOG.md b/packages/flutter_markdown/CHANGELOG.md
index b6f42a4..0d1e45d 100644
--- a/packages/flutter_markdown/CHANGELOG.md
+++ b/packages/flutter_markdown/CHANGELOG.md
@@ -1,7 +1,8 @@
-## NEXT
+## 0.6.10+1
* Updates Linux example to remove unneeded library dependencies that
could cause build failures.
+* Updates for non-nullable bindings.
## 0.6.10
diff --git a/packages/flutter_markdown/example/pubspec.yaml b/packages/flutter_markdown/example/pubspec.yaml
index 44eda03..5454129 100644
--- a/packages/flutter_markdown/example/pubspec.yaml
+++ b/packages/flutter_markdown/example/pubspec.yaml
@@ -1,6 +1,6 @@
name: flutter_markdown_example
description: Demonstrates how to use the flutter_markdown package.
-publish_to: "none"
+publish_to: none
environment:
sdk: '>=2.12.0 <3.0.0'
diff --git a/packages/flutter_markdown/pubspec.yaml b/packages/flutter_markdown/pubspec.yaml
index 31b82b2..a675b61 100644
--- a/packages/flutter_markdown/pubspec.yaml
+++ b/packages/flutter_markdown/pubspec.yaml
@@ -4,11 +4,11 @@
formatted with simple Markdown tags.
repository: https://github.com/flutter/packages/tree/main/packages/flutter_markdown
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_markdown%22
-version: 0.6.10
+version: 0.6.10+1
environment:
sdk: ">=2.12.0 <3.0.0"
- flutter: ">=1.17.0"
+ flutter: ">=3.0.0"
dependencies:
flutter:
diff --git a/packages/flutter_markdown/test/utils.dart b/packages/flutter_markdown/test/utils.dart
index dcf5288..0f1a092 100644
--- a/packages/flutter_markdown/test/utils.dart
+++ b/packages/flutter_markdown/test/utils.dart
@@ -154,10 +154,7 @@
}
String dumpRenderView() {
- return _ambiguate(WidgetsBinding.instance)!
- .renderViewElement!
- .toStringDeep()
- .replaceAll(
+ return WidgetsBinding.instance.renderViewElement!.toStringDeep().replaceAll(
RegExp(r'SliverChildListDelegate#\d+', multiLine: true),
'SliverChildListDelegate',
);
@@ -201,11 +198,3 @@
}
}
}
-
-/// This allows a value of type T or T? to be treated as a value of type T?.
-///
-/// We use this so that APIs that have become non-nullable can still be used
-/// with `!` and `?` on the stable branch.
-// TODO(ianh): Remove this once the relevant APIs have shipped to stable.
-// See https://github.com/flutter/flutter/issues/64830
-T? _ambiguate<T>(T? value) => value;
diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md
index 09de8d6..4bf27b8 100644
--- a/packages/pigeon/CHANGELOG.md
+++ b/packages/pigeon/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 3.1.1
+
+* Updates for non-nullable bindings.
+
## 3.1.0
* [c++] Adds C++ code generator.
diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart
index 97f62e0..eee7c24 100644
--- a/packages/pigeon/lib/generator_tools.dart
+++ b/packages/pigeon/lib/generator_tools.dart
@@ -5,10 +5,11 @@
import 'dart:convert';
import 'dart:io';
import 'dart:mirrors';
+
import 'ast.dart';
/// The current version of pigeon. This must match the version in pubspec.yaml.
-const String pigeonVersion = '3.1.0';
+const String pigeonVersion = '3.1.1';
/// Read all the content from [stdin] to a String.
String readStdin() {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/pubspec.yaml b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/pubspec.yaml
index dad6b7c..191bc8a 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/pubspec.yaml
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/pubspec.yaml
@@ -1,6 +1,6 @@
name: flutter_unit_tests
description: Unit test scaffold for null safe Flutter projects.
-publish_to: 'none' # Remove this line if you wish to publish to pub.dev
+publish_to: none # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.12.0 <3.0.0"
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.dart
index 5cd468c..cae18df 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_safe_test.dart
@@ -10,6 +10,7 @@
import 'package:flutter_unit_tests/nullable_returns.gen.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
+
import 'null_safe_test.mocks.dart';
import 'test_util.dart';
@@ -134,11 +135,7 @@
NullableArgFlutterApi.setup(mockFlutterApi);
final Completer<int> resultCompleter = Completer<int>();
- // Null check operator is used because ServicesBinding.instance is nullable
- // in earlier versions of Flutter.
- _ambiguate(ServicesBinding.instance)!
- .defaultBinaryMessenger
- .handlePlatformMessage(
+ ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
'dev.flutter.pigeon.NullableArgFlutterApi.doit',
NullableArgFlutterApi.codec.encodeMessage(<Object?>[null]),
(ByteData? data) {
@@ -162,11 +159,7 @@
NullableCollectionArgFlutterApi.setup(mockFlutterApi);
final Completer<List<String?>> resultCompleter = Completer<List<String?>>();
- // Null check operator is used because ServicesBinding.instance is nullable
- // in earlier versions of Flutter.
- _ambiguate(ServicesBinding.instance)!
- .defaultBinaryMessenger
- .handlePlatformMessage(
+ ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
'dev.flutter.pigeon.NullableCollectionArgFlutterApi.doit',
NullableCollectionArgFlutterApi.codec.encodeMessage(<Object?>[null]),
(ByteData? data) {
@@ -219,11 +212,7 @@
NullableReturnFlutterApi.setup(mockFlutterApi);
final Completer<int?> resultCompleter = Completer<int?>();
- // Null check operator is used because ServicesBinding.instance is nullable
- // in earlier versions of Flutter.
- _ambiguate(ServicesBinding.instance)!
- .defaultBinaryMessenger
- .handlePlatformMessage(
+ ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
'dev.flutter.pigeon.NullableReturnFlutterApi.doit',
NullableReturnFlutterApi.codec.encodeMessage(<Object?>[]),
(ByteData? data) {
@@ -246,11 +235,7 @@
final Completer<List<String?>?> resultCompleter =
Completer<List<String?>?>();
- // Null check operator is used because ServicesBinding.instance is nullable
- // in earlier versions of Flutter.
- _ambiguate(ServicesBinding.instance)!
- .defaultBinaryMessenger
- .handlePlatformMessage(
+ ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
'dev.flutter.pigeon.NullableCollectionReturnFlutterApi.doit',
NullableCollectionReturnFlutterApi.codec.encodeMessage(<Object?>[]),
(ByteData? data) {
@@ -264,10 +249,3 @@
NullableArgFlutterApi.setup(null);
});
}
-
-/// This allows a value of type T or T? to be treated as a value of type T?.
-///
-/// We use this so that APIs that have become non-nullable can still be used
-/// with `!` and `?` on the stable branch.
-// TODO(stuartmorgan): Remove this once 2.13 or later is on the stable channel.
-T? _ambiguate<T>(T? value) => value;
diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml
index 714c09d..f1e8da8 100644
--- a/packages/pigeon/pubspec.yaml
+++ b/packages/pigeon/pubspec.yaml
@@ -2,10 +2,11 @@
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon
-version: 3.1.0 # This must match the version in lib/generator_tools.dart
+version: 3.1.1 # This must match the version in lib/generator_tools.dart
environment:
sdk: ">=2.12.0 <3.0.0"
+ flutter: ">=3.0.0"
dependencies:
analyzer: ^2.4.0
diff --git a/packages/rfw/CHANGELOG.md b/packages/rfw/CHANGELOG.md
index 67b171a..3b97c65 100644
--- a/packages/rfw/CHANGELOG.md
+++ b/packages/rfw/CHANGELOG.md
@@ -1,8 +1,9 @@
-## NEXT
+## 1.0.3
* Transitions internal testing from a command line lcov tool to a
Dart tool. No effect on consumers.
* Removes unsupported platforms from the wasm example.
+* Updates for non-nullable bindings.
## 1.0.2
diff --git a/packages/rfw/example/wasm/lib/main.dart b/packages/rfw/example/wasm/lib/main.dart
index 007f1f2..0c46c21 100644
--- a/packages/rfw/example/wasm/lib/main.dart
+++ b/packages/rfw/example/wasm/lib/main.dart
@@ -38,7 +38,7 @@
@override
void initState() {
super.initState();
- _ambiguate(RendererBinding.instance)!.deferFirstFrame();
+ RendererBinding.instance.deferFirstFrame();
_runtime.update(const LibraryName(<String>['core', 'widgets']), createCoreWidgets());
_loadLogic();
}
@@ -62,7 +62,7 @@
_logic = WasmModule(await logicFile.readAsBytes()).builder().build();
_dataFetcher = _logic.lookupFunction('value');
_updateData();
- setState(() { _ambiguate(RendererBinding.instance)!.allowFirstFrame(); });
+ setState(() { RendererBinding.instance.allowFirstFrame(); });
}
void _updateData() {
@@ -78,7 +78,7 @@
@override
Widget build(BuildContext context) {
- if (!_ambiguate(RendererBinding.instance)!.sendFramesToEngine)
+ if (!RendererBinding.instance.sendFramesToEngine)
return const SizedBox.shrink();
return RemoteWidget(
runtime: _runtime,
@@ -92,11 +92,3 @@
);
}
}
-
-/// This allows a value of type T or T? to be treated as a value of type T?.
-///
-/// We use this so that APIs that have become non-nullable can still be used
-/// with `!` and `?` on the stable branch.
-// TODO(ianh): Remove this once the relevant APIs have shipped to stable.
-// See https://github.com/flutter/flutter/issues/64830
-T? _ambiguate<T>(T? value) => value;
diff --git a/packages/rfw/example/wasm/pubspec.yaml b/packages/rfw/example/wasm/pubspec.yaml
index 96af1a5..5267a69 100644
--- a/packages/rfw/example/wasm/pubspec.yaml
+++ b/packages/rfw/example/wasm/pubspec.yaml
@@ -1,6 +1,6 @@
name: rfw_wasm
description: Example of using Wasm with RFW
-publish_to: 'none' # Remove this line if you wish to publish to pub.dev
+publish_to: none # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
diff --git a/packages/rfw/pubspec.yaml b/packages/rfw/pubspec.yaml
index ff93edf..8865604 100644
--- a/packages/rfw/pubspec.yaml
+++ b/packages/rfw/pubspec.yaml
@@ -2,11 +2,11 @@
description: "Remote Flutter widgets: a library for rendering declarative widget description files at runtime."
repository: https://github.com/flutter/packages/tree/main/packages/rfw
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+rfw%22
-version: 1.0.2
+version: 1.0.3
environment:
sdk: ">=2.13.0 <3.0.0"
- flutter: ">=1.17.0"
+ flutter: ">=3.0.0"
dependencies:
flutter:
@@ -16,3 +16,4 @@
dev_dependencies:
flutter_test:
sdk: flutter
+ lcov_parser: ^0.1.2