From bbdf617034171ab1128a594fb24e1c72a09e072e Mon Sep 17 00:00:00 2001
From: Alexandre Ardhuin <alexandre.ardhuin@gmail.com>
Date: Tue, 28 Jun 2022 22:26:06 +0200
Subject: [PATCH] Export public API types from services/*.dart library
 (#106316)

---
 .../platform_channels_benchmarks/lib/main.dart        |  1 -
 .../channels/lib/src/basic_messaging.dart             |  1 -
 .../test/example_code_parser_test.dart                |  2 --
 dev/tools/gen_keycodes/data/keyboard_key.tmpl         |  2 ++
 dev/tools/gen_keycodes/data/keyboard_maps.tmpl        |  2 ++
 examples/image_list/lib/main.dart                     |  1 -
 packages/flutter/lib/src/rendering/view.dart          |  1 -
 packages/flutter/lib/src/services/asset_bundle.dart   |  3 +++
 packages/flutter/lib/src/services/autofill.dart       |  3 +++
 .../flutter/lib/src/services/binary_messenger.dart    |  3 +++
 packages/flutter/lib/src/services/binding.dart        |  7 ++++++-
 packages/flutter/lib/src/services/debug.dart          |  2 ++
 packages/flutter/lib/src/services/font_loader.dart    |  2 ++
 .../flutter/lib/src/services/hardware_keyboard.dart   |  9 ++++++++-
 packages/flutter/lib/src/services/keyboard_key.dart   |  2 ++
 packages/flutter/lib/src/services/keyboard_maps.dart  |  2 ++
 packages/flutter/lib/src/services/message_codecs.dart |  6 ++++++
 packages/flutter/lib/src/services/mouse_cursor.dart   |  3 +++
 packages/flutter/lib/src/services/mouse_tracking.dart |  5 +++++
 .../flutter/lib/src/services/platform_channel.dart    |  4 +++-
 packages/flutter/lib/src/services/platform_views.dart |  6 ++++++
 packages/flutter/lib/src/services/raw_keyboard.dart   |  4 ++++
 .../lib/src/services/raw_keyboard_android.dart        |  6 +++++-
 .../lib/src/services/raw_keyboard_fuchsia.dart        |  6 +++++-
 .../flutter/lib/src/services/raw_keyboard_ios.dart    |  6 +++++-
 .../flutter/lib/src/services/raw_keyboard_linux.dart  |  6 +++++-
 .../flutter/lib/src/services/raw_keyboard_macos.dart  |  6 +++++-
 .../flutter/lib/src/services/raw_keyboard_web.dart    |  6 +++++-
 .../lib/src/services/raw_keyboard_windows.dart        |  6 +++++-
 packages/flutter/lib/src/services/restoration.dart    |  3 ++-
 .../flutter/lib/src/services/system_channels.dart     |  2 ++
 packages/flutter/lib/src/services/system_chrome.dart  |  4 +++-
 packages/flutter/lib/src/services/text_editing.dart   |  2 +-
 .../flutter/lib/src/services/text_editing_delta.dart  |  7 +++++++
 packages/flutter/lib/src/services/text_formatter.dart |  5 ++++-
 packages/flutter/lib/src/services/text_input.dart     | 11 +++++++++--
 .../flutter/lib/src/services/text_layout_metrics.dart |  6 ++++++
 packages/flutter/test/services/autofill_test.dart     |  2 --
 .../flutter/test/services/delta_text_input_test.dart  |  1 -
 packages/flutter/test/services/font_loader_test.dart  |  2 --
 .../flutter/test/services/message_codecs_test.dart    |  1 -
 .../flutter/test/services/platform_views_test.dart    |  1 -
 packages/flutter/test/services/restoration.dart       |  2 --
 packages/flutter/test/services/restoration_test.dart  |  2 --
 packages/flutter/test/services/text_input_test.dart   |  1 -
 packages/flutter/test/services/text_input_utils.dart  |  1 -
 packages/flutter_test/lib/src/_binding_io.dart        |  1 -
 packages/flutter_test/lib/src/test_text_input.dart    |  2 --
 .../test/test_default_binary_messenger_test.dart      |  1 -
 49 files changed, 131 insertions(+), 39 deletions(-)

diff --git a/dev/benchmarks/platform_channels_benchmarks/lib/main.dart b/dev/benchmarks/platform_channels_benchmarks/lib/main.dart
index 06081bfede6d..b5850e1ae9e5 100644
--- a/dev/benchmarks/platform_channels_benchmarks/lib/main.dart
+++ b/dev/benchmarks/platform_channels_benchmarks/lib/main.dart
@@ -4,7 +4,6 @@
 
 import 'dart:async';
 import 'dart:math' as math;
-import 'dart:typed_data';
 
 import 'package:flutter/foundation.dart' show kDebugMode;
 import 'package:flutter/material.dart';
diff --git a/dev/integration_tests/channels/lib/src/basic_messaging.dart b/dev/integration_tests/channels/lib/src/basic_messaging.dart
index dfd516dda2ee..f52dd377b3e4 100644
--- a/dev/integration_tests/channels/lib/src/basic_messaging.dart
+++ b/dev/integration_tests/channels/lib/src/basic_messaging.dart
@@ -4,7 +4,6 @@
 
 import 'dart:async';
 
-import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
 import 'package:flutter/services.dart';
 
 import 'pair.dart';
diff --git a/dev/integration_tests/flutter_gallery/test/example_code_parser_test.dart b/dev/integration_tests/flutter_gallery/test/example_code_parser_test.dart
index 18700928f4f5..1200dcba3cff 100644
--- a/dev/integration_tests/flutter_gallery/test/example_code_parser_test.dart
+++ b/dev/integration_tests/flutter_gallery/test/example_code_parser_test.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.
 
-import 'dart:typed_data';
-
 import 'package:flutter/services.dart';
 import 'package:flutter_gallery/gallery/example_code_parser.dart';
 import 'package:flutter_test/flutter_test.dart';
diff --git a/dev/tools/gen_keycodes/data/keyboard_key.tmpl b/dev/tools/gen_keycodes/data/keyboard_key.tmpl
index e13e03582fbe..ce8f758e07b2 100644
--- a/dev/tools/gen_keycodes/data/keyboard_key.tmpl
+++ b/dev/tools/gen_keycodes/data/keyboard_key.tmpl
@@ -4,6 +4,8 @@
 
 import 'package:flutter/foundation.dart';
 
+export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
+
 // DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT
 // This file is generated by dev/tools/gen_keycodes/bin/gen_keycodes.dart and
 // should not be edited directly.
diff --git a/dev/tools/gen_keycodes/data/keyboard_maps.tmpl b/dev/tools/gen_keycodes/data/keyboard_maps.tmpl
index c4ce2fc9ed15..8a80093e6c83 100644
--- a/dev/tools/gen_keycodes/data/keyboard_maps.tmpl
+++ b/dev/tools/gen_keycodes/data/keyboard_maps.tmpl
@@ -11,6 +11,8 @@
 
 import 'keyboard_key.dart';
 
+export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
+
 /// Maps Android-specific key codes to the matching [LogicalKeyboardKey].
 const Map<int, LogicalKeyboardKey> kAndroidToLogicalKey = <int, LogicalKeyboardKey>{
 @@@ANDROID_KEY_CODE_MAP@@@
diff --git a/examples/image_list/lib/main.dart b/examples/image_list/lib/main.dart
index a4a2b6e644cc..6f5c76d9e713 100644
--- a/examples/image_list/lib/main.dart
+++ b/examples/image_list/lib/main.dart
@@ -5,7 +5,6 @@
 import 'dart:async';
 import 'dart:io';
 import 'dart:math';
-import 'dart:typed_data';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 
diff --git a/packages/flutter/lib/src/rendering/view.dart b/packages/flutter/lib/src/rendering/view.dart
index 86933599ced7..e3a86b871a35 100644
--- a/packages/flutter/lib/src/rendering/view.dart
+++ b/packages/flutter/lib/src/rendering/view.dart
@@ -8,7 +8,6 @@ import 'dart:ui' as ui show Scene, SceneBuilder, FlutterView;
 
 import 'package:flutter/foundation.dart';
 import 'package:flutter/services.dart';
-import 'package:vector_math/vector_math_64.dart';
 
 import 'binding.dart';
 import 'box.dart';
diff --git a/packages/flutter/lib/src/services/asset_bundle.dart b/packages/flutter/lib/src/services/asset_bundle.dart
index 33c2945ae8a1..ce8bd1936ae2 100644
--- a/packages/flutter/lib/src/services/asset_bundle.dart
+++ b/packages/flutter/lib/src/services/asset_bundle.dart
@@ -11,6 +11,9 @@ import 'package:flutter/foundation.dart';
 
 import 'binding.dart';
 
+export 'dart:typed_data' show ByteData;
+export 'dart:ui' show ImmutableBuffer;
+
 /// A collection of resources used by the application.
 ///
 /// Asset bundles contain resources, such as images and strings, that can be
diff --git a/packages/flutter/lib/src/services/autofill.dart b/packages/flutter/lib/src/services/autofill.dart
index 22cde8eb0bd3..d5ea1619c9c0 100644
--- a/packages/flutter/lib/src/services/autofill.dart
+++ b/packages/flutter/lib/src/services/autofill.dart
@@ -3,8 +3,11 @@
 // found in the LICENSE file.
 
 import 'package:flutter/foundation.dart';
+
 import 'text_input.dart';
 
+export 'text_input.dart' show TextEditingValue, TextInputClient, TextInputConfiguration, TextInputConnection;
+
 /// A collection of commonly used autofill hint strings on different platforms.
 ///
 /// Each hint is pre-defined on at least one supported platform. See their
diff --git a/packages/flutter/lib/src/services/binary_messenger.dart b/packages/flutter/lib/src/services/binary_messenger.dart
index 1acf6f5cb2c6..b24093c078cf 100644
--- a/packages/flutter/lib/src/services/binary_messenger.dart
+++ b/packages/flutter/lib/src/services/binary_messenger.dart
@@ -5,6 +5,9 @@
 import 'dart:typed_data';
 import 'dart:ui' as ui;
 
+export 'dart:typed_data' show ByteData;
+export 'dart:ui' show PlatformMessageResponseCallback;
+
 /// A function which takes a platform message and asynchronously returns an encoded response.
 typedef MessageHandler = Future<ByteData?>? Function(ByteData? message);
 
diff --git a/packages/flutter/lib/src/services/binding.dart b/packages/flutter/lib/src/services/binding.dart
index 9c04cb2c0da6..5fd8436b3293 100644
--- a/packages/flutter/lib/src/services/binding.dart
+++ b/packages/flutter/lib/src/services/binding.dart
@@ -14,11 +14,16 @@ import 'asset_bundle.dart';
 import 'binary_messenger.dart';
 import 'hardware_keyboard.dart';
 import 'message_codec.dart';
-import 'raw_keyboard.dart';
 import 'restoration.dart';
 import 'system_channels.dart';
 import 'text_input.dart';
 
+export 'dart:ui' show ChannelBuffers;
+
+export 'binary_messenger.dart' show BinaryMessenger;
+export 'hardware_keyboard.dart' show HardwareKeyboard, KeyEventManager;
+export 'restoration.dart' show RestorationManager;
+
 /// Listens for platform messages and directs them to the [defaultBinaryMessenger].
 ///
 /// The [ServicesBinding] also registers a [LicenseEntryCollector] that exposes
diff --git a/packages/flutter/lib/src/services/debug.dart b/packages/flutter/lib/src/services/debug.dart
index 86c2d3831b52..68f667b57017 100644
--- a/packages/flutter/lib/src/services/debug.dart
+++ b/packages/flutter/lib/src/services/debug.dart
@@ -6,6 +6,8 @@ import 'package:flutter/foundation.dart';
 
 import 'hardware_keyboard.dart';
 
+export 'hardware_keyboard.dart' show KeyDataTransitMode;
+
 /// Override the transit mode with which key events are simulated.
 ///
 /// Setting [debugKeyEventSimulatorTransitModeOverride] is a good way to make
diff --git a/packages/flutter/lib/src/services/font_loader.dart b/packages/flutter/lib/src/services/font_loader.dart
index a3e1530b1efd..cb0e099fcae0 100644
--- a/packages/flutter/lib/src/services/font_loader.dart
+++ b/packages/flutter/lib/src/services/font_loader.dart
@@ -6,6 +6,8 @@ import 'dart:ui';
 
 import 'package:flutter/foundation.dart';
 
+export 'dart:typed_data' show ByteData;
+
 /// A class that enables the dynamic loading of fonts at runtime.
 ///
 /// The [FontLoader] class provides a builder pattern, where the caller builds
diff --git a/packages/flutter/lib/src/services/hardware_keyboard.dart b/packages/flutter/lib/src/services/hardware_keyboard.dart
index a6379368e053..8ab8002420c7 100644
--- a/packages/flutter/lib/src/services/hardware_keyboard.dart
+++ b/packages/flutter/lib/src/services/hardware_keyboard.dart
@@ -5,10 +5,17 @@
 import 'dart:ui' as ui;
 
 import 'package:flutter/foundation.dart';
+
 import 'binding.dart';
-import 'keyboard_key.dart';
 import 'raw_keyboard.dart';
 
+export 'dart:ui' show KeyData;
+
+export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
+
+export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
+export 'raw_keyboard.dart' show RawKeyboard, RawKeyEvent;
+
 /// Represents a lock mode of a keyboard, such as [KeyboardLockMode.capsLock].
 ///
 /// A lock mode locks some of a keyboard's keys into a distinct mode of operation,
diff --git a/packages/flutter/lib/src/services/keyboard_key.dart b/packages/flutter/lib/src/services/keyboard_key.dart
index 29741c680638..b05cd3963978 100644
--- a/packages/flutter/lib/src/services/keyboard_key.dart
+++ b/packages/flutter/lib/src/services/keyboard_key.dart
@@ -4,6 +4,8 @@
 
 import 'package:flutter/foundation.dart';
 
+export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
+
 // DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT
 // This file is generated by dev/tools/gen_keycodes/bin/gen_keycodes.dart and
 // should not be edited directly.
diff --git a/packages/flutter/lib/src/services/keyboard_maps.dart b/packages/flutter/lib/src/services/keyboard_maps.dart
index 6d34631d9b90..18aeb35242cb 100644
--- a/packages/flutter/lib/src/services/keyboard_maps.dart
+++ b/packages/flutter/lib/src/services/keyboard_maps.dart
@@ -11,6 +11,8 @@
 
 import 'keyboard_key.dart';
 
+export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
+
 /// Maps Android-specific key codes to the matching [LogicalKeyboardKey].
 const Map<int, LogicalKeyboardKey> kAndroidToLogicalKey = <int, LogicalKeyboardKey>{
   3: LogicalKeyboardKey.goHome,
diff --git a/packages/flutter/lib/src/services/message_codecs.dart b/packages/flutter/lib/src/services/message_codecs.dart
index bfd0e498bbef..6aecc8607d6a 100644
--- a/packages/flutter/lib/src/services/message_codecs.dart
+++ b/packages/flutter/lib/src/services/message_codecs.dart
@@ -9,6 +9,12 @@ import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
 
 import 'message_codec.dart';
 
+export 'dart:typed_data' show ByteData;
+
+export 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
+
+export 'message_codec.dart' show MethodCall;
+
 const int _writeBufferStartCapacity = 64;
 
 /// [MessageCodec] with unencoded binary messages represented using [ByteData].
diff --git a/packages/flutter/lib/src/services/mouse_cursor.dart b/packages/flutter/lib/src/services/mouse_cursor.dart
index d94bfa67c1e6..5abe5cc08c92 100644
--- a/packages/flutter/lib/src/services/mouse_cursor.dart
+++ b/packages/flutter/lib/src/services/mouse_cursor.dart
@@ -7,6 +7,9 @@ import 'package:flutter/gestures.dart';
 
 import 'system_channels.dart';
 
+export 'package:flutter/foundation.dart' show DiagnosticLevel, DiagnosticPropertiesBuilder;
+export 'package:flutter/gestures.dart' show PointerEvent;
+
 /// Maintains the state of mouse cursors and manages how cursors are searched
 /// for.
 ///
diff --git a/packages/flutter/lib/src/services/mouse_tracking.dart b/packages/flutter/lib/src/services/mouse_tracking.dart
index f424e801d001..a66216db2fd1 100644
--- a/packages/flutter/lib/src/services/mouse_tracking.dart
+++ b/packages/flutter/lib/src/services/mouse_tracking.dart
@@ -7,6 +7,11 @@ import 'package:flutter/gestures.dart';
 
 import 'mouse_cursor.dart';
 
+export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
+export 'package:flutter/gestures.dart' show PointerEnterEvent, PointerExitEvent, PointerHoverEvent;
+
+export 'mouse_cursor.dart' show MouseCursor;
+
 /// Signature for listening to [PointerEnterEvent] events.
 ///
 /// Used by [MouseTrackerAnnotation], [MouseRegion] and [RenderMouseRegion].
diff --git a/packages/flutter/lib/src/services/platform_channel.dart b/packages/flutter/lib/src/services/platform_channel.dart
index 42d1d95f60f8..47b609b3de82 100644
--- a/packages/flutter/lib/src/services/platform_channel.dart
+++ b/packages/flutter/lib/src/services/platform_channel.dart
@@ -4,7 +4,6 @@
 
 import 'dart:async';
 import 'dart:developer';
-import 'dart:ui' show PlatformMessageResponseCallback;
 
 import 'package:flutter/foundation.dart';
 
@@ -14,6 +13,9 @@ import 'debug.dart' show debugProfilePlatformChannels;
 import 'message_codec.dart';
 import 'message_codecs.dart';
 
+export 'binary_messenger.dart' show BinaryMessenger;
+export 'message_codec.dart' show MessageCodec, MethodCall, MethodCodec;
+
 bool _debugProfilePlatformChannelsIsRunning = false;
 const Duration _debugProfilePlatformChannelsRate = Duration(seconds: 1);
 final Expando<BinaryMessenger> _debugBinaryMessengers = Expando<BinaryMessenger>();
diff --git a/packages/flutter/lib/src/services/platform_views.dart b/packages/flutter/lib/src/services/platform_views.dart
index f4df2dd9b7ee..25af4c9fad27 100644
--- a/packages/flutter/lib/src/services/platform_views.dart
+++ b/packages/flutter/lib/src/services/platform_views.dart
@@ -11,6 +11,12 @@ import 'package:flutter/gestures.dart';
 import 'message_codec.dart';
 import 'system_channels.dart';
 
+export 'dart:ui' show Offset, Size, TextDirection, VoidCallback;
+
+export 'package:flutter/gestures.dart' show PointerEvent;
+
+export 'message_codec.dart' show MessageCodec;
+
 /// Converts a given point from the global coordinate system in logical pixels
 /// to the local coordinate system for a box.
 ///
diff --git a/packages/flutter/lib/src/services/raw_keyboard.dart b/packages/flutter/lib/src/services/raw_keyboard.dart
index e9fa625bb1ce..1520a6c78354 100644
--- a/packages/flutter/lib/src/services/raw_keyboard.dart
+++ b/packages/flutter/lib/src/services/raw_keyboard.dart
@@ -17,6 +17,10 @@ import 'raw_keyboard_web.dart';
 import 'raw_keyboard_windows.dart';
 import 'system_channels.dart';
 
+export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder, ValueChanged;
+
+export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
+
 /// An enum describing the side of the keyboard that a key is on, to allow
 /// discrimination between which key is pressed (e.g. the left or right SHIFT
 /// key).
diff --git a/packages/flutter/lib/src/services/raw_keyboard_android.dart b/packages/flutter/lib/src/services/raw_keyboard_android.dart
index 0a3ac7d4ce80..e7d1764bf70a 100644
--- a/packages/flutter/lib/src/services/raw_keyboard_android.dart
+++ b/packages/flutter/lib/src/services/raw_keyboard_android.dart
@@ -4,10 +4,14 @@
 
 import 'package:flutter/foundation.dart';
 
-import 'keyboard_key.dart';
 import 'keyboard_maps.dart';
 import 'raw_keyboard.dart';
 
+export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
+
+export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
+export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
+
 // Android sets the 0x80000000 bit on a character to indicate that it is a
 // combining character, so we use this mask to remove that bit to make it a
 // valid Unicode character again.
diff --git a/packages/flutter/lib/src/services/raw_keyboard_fuchsia.dart b/packages/flutter/lib/src/services/raw_keyboard_fuchsia.dart
index bed320514753..da047bb656fc 100644
--- a/packages/flutter/lib/src/services/raw_keyboard_fuchsia.dart
+++ b/packages/flutter/lib/src/services/raw_keyboard_fuchsia.dart
@@ -4,10 +4,14 @@
 
 import 'package:flutter/foundation.dart';
 
-import 'keyboard_key.dart';
 import 'keyboard_maps.dart';
 import 'raw_keyboard.dart';
 
+export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
+
+export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
+export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
+
 /// Platform-specific key event data for Fuchsia.
 ///
 /// This object contains information about key events obtained from Fuchsia's
diff --git a/packages/flutter/lib/src/services/raw_keyboard_ios.dart b/packages/flutter/lib/src/services/raw_keyboard_ios.dart
index 70c0707313d1..df86f353c020 100644
--- a/packages/flutter/lib/src/services/raw_keyboard_ios.dart
+++ b/packages/flutter/lib/src/services/raw_keyboard_ios.dart
@@ -4,10 +4,14 @@
 
 import 'package:flutter/foundation.dart';
 
-import 'keyboard_key.dart';
 import 'keyboard_maps.dart';
 import 'raw_keyboard.dart';
 
+export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
+
+export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
+export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
+
 /// Maps iOS specific string values of nonvisible keys to logical keys
 ///
 /// See: https://developer.apple.com/documentation/uikit/uikeycommand/input_strings_for_special_keys?language=objc
diff --git a/packages/flutter/lib/src/services/raw_keyboard_linux.dart b/packages/flutter/lib/src/services/raw_keyboard_linux.dart
index bf8815e72bd9..8f58243c143f 100644
--- a/packages/flutter/lib/src/services/raw_keyboard_linux.dart
+++ b/packages/flutter/lib/src/services/raw_keyboard_linux.dart
@@ -4,10 +4,14 @@
 
 import 'package:flutter/foundation.dart';
 
-import 'keyboard_key.dart';
 import 'keyboard_maps.dart';
 import 'raw_keyboard.dart';
 
+export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
+
+export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
+export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
+
 /// Platform-specific key event data for Linux.
 ///
 /// Different window toolkit implementations can map to different key codes. This class
diff --git a/packages/flutter/lib/src/services/raw_keyboard_macos.dart b/packages/flutter/lib/src/services/raw_keyboard_macos.dart
index b5119e71eae5..bbc82e8be452 100644
--- a/packages/flutter/lib/src/services/raw_keyboard_macos.dart
+++ b/packages/flutter/lib/src/services/raw_keyboard_macos.dart
@@ -4,10 +4,14 @@
 
 import 'package:flutter/foundation.dart';
 
-import 'keyboard_key.dart';
 import 'keyboard_maps.dart';
 import 'raw_keyboard.dart';
 
+export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
+
+export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
+export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
+
 /// Convert a UTF32 rune to its lower case.
 int runeToLowerCase(int rune) {
   // Assume only Basic Multilingual Plane runes have lower and upper cases.
diff --git a/packages/flutter/lib/src/services/raw_keyboard_web.dart b/packages/flutter/lib/src/services/raw_keyboard_web.dart
index 1c32c4593962..8d6fcadd1728 100644
--- a/packages/flutter/lib/src/services/raw_keyboard_web.dart
+++ b/packages/flutter/lib/src/services/raw_keyboard_web.dart
@@ -4,10 +4,14 @@
 
 import 'package:flutter/foundation.dart';
 
-import 'keyboard_key.dart';
 import 'keyboard_maps.dart';
 import 'raw_keyboard.dart';
 
+export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
+
+export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
+export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
+
 String? _unicodeChar(String key) {
   if (key.length == 1) {
     return key.substring(0, 1);
diff --git a/packages/flutter/lib/src/services/raw_keyboard_windows.dart b/packages/flutter/lib/src/services/raw_keyboard_windows.dart
index 204fbb693f59..1e393cb37b64 100644
--- a/packages/flutter/lib/src/services/raw_keyboard_windows.dart
+++ b/packages/flutter/lib/src/services/raw_keyboard_windows.dart
@@ -4,10 +4,14 @@
 
 import 'package:flutter/foundation.dart';
 
-import 'keyboard_key.dart';
 import 'keyboard_maps.dart';
 import 'raw_keyboard.dart';
 
+export 'package:flutter/foundation.dart' show DiagnosticPropertiesBuilder;
+
+export 'keyboard_key.dart' show LogicalKeyboardKey, PhysicalKeyboardKey;
+export 'raw_keyboard.dart' show KeyboardSide, ModifierKey;
+
 // Virtual key VK_PROCESSKEY in Win32 API.
 //
 // Key down events related to IME operations use this as keyCode.
diff --git a/packages/flutter/lib/src/services/restoration.dart b/packages/flutter/lib/src/services/restoration.dart
index 9235fda18ea4..e2f59d5e403d 100644
--- a/packages/flutter/lib/src/services/restoration.dart
+++ b/packages/flutter/lib/src/services/restoration.dart
@@ -7,10 +7,11 @@ import 'dart:async';
 import 'package:flutter/foundation.dart';
 import 'package:flutter/scheduler.dart';
 
-import 'message_codec.dart';
 import 'message_codecs.dart';
 import 'system_channels.dart';
 
+export 'dart:typed_data' show Uint8List;
+
 typedef _BucketVisitor = void Function(RestorationBucket bucket);
 
 /// Manages the restoration data in the framework and synchronizes it with the
diff --git a/packages/flutter/lib/src/services/system_channels.dart b/packages/flutter/lib/src/services/system_channels.dart
index 91233761809a..ee9712ec6748 100644
--- a/packages/flutter/lib/src/services/system_channels.dart
+++ b/packages/flutter/lib/src/services/system_channels.dart
@@ -7,6 +7,8 @@ import 'dart:ui';
 import 'message_codecs.dart';
 import 'platform_channel.dart';
 
+export 'platform_channel.dart' show BasicMessageChannel, MethodChannel;
+
 /// Platform channels used by the Flutter system.
 class SystemChannels {
   // This class is not meant to be instantiated or extended; this constructor
diff --git a/packages/flutter/lib/src/services/system_chrome.dart b/packages/flutter/lib/src/services/system_chrome.dart
index 6e623a66f571..6b295d7eae36 100644
--- a/packages/flutter/lib/src/services/system_chrome.dart
+++ b/packages/flutter/lib/src/services/system_chrome.dart
@@ -10,7 +10,9 @@ import 'package:flutter/foundation.dart';
 import 'binding.dart';
 import 'system_channels.dart';
 
-export 'dart:ui' show Brightness;
+export 'dart:ui' show Brightness, Color;
+
+export 'binding.dart' show SystemUiChangeCallback;
 
 /// Specifies a particular device orientation.
 ///
diff --git a/packages/flutter/lib/src/services/text_editing.dart b/packages/flutter/lib/src/services/text_editing.dart
index df1c42703db9..39c8caeb80de 100644
--- a/packages/flutter/lib/src/services/text_editing.dart
+++ b/packages/flutter/lib/src/services/text_editing.dart
@@ -6,7 +6,7 @@ import 'dart:ui' show TextAffinity, TextPosition, TextRange;
 
 import 'package:flutter/foundation.dart';
 
-export 'dart:ui' show TextAffinity, TextPosition, TextRange;
+export 'dart:ui' show TextAffinity, TextPosition;
 
 /// A range of text that represents a selection.
 @immutable
diff --git a/packages/flutter/lib/src/services/text_editing_delta.dart b/packages/flutter/lib/src/services/text_editing_delta.dart
index 07e57e93c6c6..45c5473777b4 100644
--- a/packages/flutter/lib/src/services/text_editing_delta.dart
+++ b/packages/flutter/lib/src/services/text_editing_delta.dart
@@ -2,11 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+import 'dart:ui' show TextRange;
+
 import 'package:flutter/foundation.dart';
 
 import 'text_editing.dart';
 import 'text_input.dart' show TextEditingValue;
 
+export 'dart:ui' show TextRange;
+
+export 'text_editing.dart' show TextSelection;
+export 'text_input.dart' show TextEditingValue;
+
 TextAffinity? _toTextAffinity(String? affinity) {
   switch (affinity) {
     case 'TextAffinity.downstream':
diff --git a/packages/flutter/lib/src/services/text_formatter.dart b/packages/flutter/lib/src/services/text_formatter.dart
index 413baa3fd2ef..89c2478b6070 100644
--- a/packages/flutter/lib/src/services/text_formatter.dart
+++ b/packages/flutter/lib/src/services/text_formatter.dart
@@ -8,9 +8,12 @@ import 'dart:math' as math;
 import 'package:characters/characters.dart';
 import 'package:flutter/foundation.dart';
 
-import 'text_editing.dart';
 import 'text_input.dart';
 
+export 'package:flutter/foundation.dart' show TargetPlatform;
+
+export 'text_input.dart' show TextEditingValue;
+
 /// {@template flutter.services.textFormatter.maxLengthEnforcement}
 /// ### [MaxLengthEnforcement.enforced] versus
 /// [MaxLengthEnforcement.truncateAfterCompositionEnds]
diff --git a/packages/flutter/lib/src/services/text_input.dart b/packages/flutter/lib/src/services/text_input.dart
index 52cc6a5238eb..4fee13bb9b96 100644
--- a/packages/flutter/lib/src/services/text_input.dart
+++ b/packages/flutter/lib/src/services/text_input.dart
@@ -15,15 +15,22 @@ import 'dart:ui' show
 import 'package:flutter/foundation.dart';
 import 'package:vector_math/vector_math_64.dart' show Matrix4;
 
-import '../../services.dart' show Clipboard;
 import 'autofill.dart';
+import 'clipboard.dart' show Clipboard;
 import 'message_codec.dart';
 import 'platform_channel.dart';
 import 'system_channels.dart';
 import 'text_editing.dart';
 import 'text_editing_delta.dart';
 
-export 'dart:ui' show TextAffinity;
+export 'dart:ui' show Brightness, FontWeight, Offset, Rect, Size, TextAlign, TextDirection, TextPosition, TextRange;
+
+export 'package:vector_math/vector_math_64.dart' show Matrix4;
+
+export 'autofill.dart' show AutofillConfiguration, AutofillScope;
+export 'text_editing.dart' show TextSelection;
+// TODO(a14n): the following export leads to Segmentation fault, see https://github.com/flutter/flutter/issues/106332
+// export 'text_editing_delta.dart' show TextEditingDelta;
 
 /// Indicates how to handle the intelligent replacement of dashes in text input.
 ///
diff --git a/packages/flutter/lib/src/services/text_layout_metrics.dart b/packages/flutter/lib/src/services/text_layout_metrics.dart
index 3f0864e74df5..c5bc3d1bab5c 100644
--- a/packages/flutter/lib/src/services/text_layout_metrics.dart
+++ b/packages/flutter/lib/src/services/text_layout_metrics.dart
@@ -2,8 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+import 'dart:ui' show TextRange;
+
 import 'text_editing.dart';
 
+export 'dart:ui' show TextPosition, TextRange;
+
+export 'text_editing.dart' show TextSelection;
+
 /// A read-only interface for accessing visual information about the
 /// implementing text.
 abstract class TextLayoutMetrics {
diff --git a/packages/flutter/test/services/autofill_test.dart b/packages/flutter/test/services/autofill_test.dart
index e463a08fc607..366f37040aa8 100644
--- a/packages/flutter/test/services/autofill_test.dart
+++ b/packages/flutter/test/services/autofill_test.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.
 
-import 'dart:ui';
-
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
 
diff --git a/packages/flutter/test/services/delta_text_input_test.dart b/packages/flutter/test/services/delta_text_input_test.dart
index 330c46188185..96358af87988 100644
--- a/packages/flutter/test/services/delta_text_input_test.dart
+++ b/packages/flutter/test/services/delta_text_input_test.dart
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 import 'dart:convert' show jsonDecode;
-import 'dart:ui';
 
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
diff --git a/packages/flutter/test/services/font_loader_test.dart b/packages/flutter/test/services/font_loader_test.dart
index ac5ffffa99f9..473a8da7d090 100644
--- a/packages/flutter/test/services/font_loader_test.dart
+++ b/packages/flutter/test/services/font_loader_test.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.
 
-import 'dart:typed_data';
-
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
 
diff --git a/packages/flutter/test/services/message_codecs_test.dart b/packages/flutter/test/services/message_codecs_test.dart
index d0d111d2bd07..5b8afc9b6dba 100644
--- a/packages/flutter/test/services/message_codecs_test.dart
+++ b/packages/flutter/test/services/message_codecs_test.dart
@@ -8,7 +8,6 @@
 import 'dart:convert';
 import 'dart:typed_data';
 
-import 'package:flutter/foundation.dart' show WriteBuffer;
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
 
diff --git a/packages/flutter/test/services/platform_views_test.dart b/packages/flutter/test/services/platform_views_test.dart
index 266bbfaac6a8..de64649069b3 100644
--- a/packages/flutter/test/services/platform_views_test.dart
+++ b/packages/flutter/test/services/platform_views_test.dart
@@ -2,7 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import 'package:flutter/painting.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
 
diff --git a/packages/flutter/test/services/restoration.dart b/packages/flutter/test/services/restoration.dart
index 9498e87f28b0..02dc1d3a055c 100644
--- a/packages/flutter/test/services/restoration.dart
+++ b/packages/flutter/test/services/restoration.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.
 
-import 'dart:typed_data';
-
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
 
diff --git a/packages/flutter/test/services/restoration_test.dart b/packages/flutter/test/services/restoration_test.dart
index 56b4a27bb50e..368761db23bf 100644
--- a/packages/flutter/test/services/restoration_test.dart
+++ b/packages/flutter/test/services/restoration_test.dart
@@ -2,9 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-
 import 'dart:async';
-import 'dart:typed_data';
 
 import 'package:flutter/scheduler.dart';
 import 'package:flutter/services.dart';
diff --git a/packages/flutter/test/services/text_input_test.dart b/packages/flutter/test/services/text_input_test.dart
index 426ca8166d42..289f38631863 100644
--- a/packages/flutter/test/services/text_input_test.dart
+++ b/packages/flutter/test/services/text_input_test.dart
@@ -4,7 +4,6 @@
 
 
 import 'dart:convert' show jsonDecode;
-import 'dart:ui';
 
 import 'package:flutter/foundation.dart';
 import 'package:flutter/services.dart';
diff --git a/packages/flutter/test/services/text_input_utils.dart b/packages/flutter/test/services/text_input_utils.dart
index 2598c098a850..67a89e69a912 100644
--- a/packages/flutter/test/services/text_input_utils.dart
+++ b/packages/flutter/test/services/text_input_utils.dart
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 import 'dart:convert' show utf8;
-import 'dart:ui';
 
 import 'package:flutter/services.dart';
 import 'package:flutter_test/flutter_test.dart';
diff --git a/packages/flutter_test/lib/src/_binding_io.dart b/packages/flutter_test/lib/src/_binding_io.dart
index 4643da0f8480..0dc72180fde8 100644
--- a/packages/flutter_test/lib/src/_binding_io.dart
+++ b/packages/flutter_test/lib/src/_binding_io.dart
@@ -5,7 +5,6 @@
 import 'dart:async';
 import 'dart:convert';
 import 'dart:io';
-import 'dart:typed_data';
 
 import 'package:flutter/services.dart';
 import 'package:flutter/widgets.dart';
diff --git a/packages/flutter_test/lib/src/test_text_input.dart b/packages/flutter_test/lib/src/test_text_input.dart
index c0fb1148687b..1b27c413f256 100644
--- a/packages/flutter_test/lib/src/test_text_input.dart
+++ b/packages/flutter_test/lib/src/test_text_input.dart
@@ -3,9 +3,7 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:ui' show Rect, Offset;
 
-import 'package:flutter/foundation.dart';
 import 'package:flutter/services.dart';
 
 import 'binding.dart';
diff --git a/packages/flutter_test/test/test_default_binary_messenger_test.dart b/packages/flutter_test/test/test_default_binary_messenger_test.dart
index 116dee33a098..82d2e4c4c26c 100644
--- a/packages/flutter_test/test/test_default_binary_messenger_test.dart
+++ b/packages/flutter_test/test/test_default_binary_messenger_test.dart
@@ -2,7 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import 'dart:typed_data';
 import 'dart:ui' as ui;
 
 import 'package:flutter/services.dart';