Unverified Commit 31798757 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

replace some ._() constructors with class modifiers (#122765)

parent 7b7af9f3
...@@ -42,7 +42,7 @@ linter: ...@@ -42,7 +42,7 @@ linter:
- avoid_bool_literals_in_conditional_expressions - avoid_bool_literals_in_conditional_expressions
# - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023 # - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023
# - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023 # - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023
- avoid_classes_with_only_static_members # avoid_classes_with_only_static_members # # we do this commonly for `abstract final class`es
- avoid_double_and_int_checks - avoid_double_and_int_checks
- avoid_dynamic_calls - avoid_dynamic_calls
- avoid_empty_else - avoid_empty_else
......
...@@ -116,9 +116,7 @@ class BenchMouseRegionGridHover extends WidgetRecorder { ...@@ -116,9 +116,7 @@ class BenchMouseRegionGridHover extends WidgetRecorder {
} }
} }
class _UntilNextFrame { abstract final class _UntilNextFrame {
_UntilNextFrame._();
static Completer<void>? _completer; static Completer<void>? _completer;
static Future<void> wait() { static Future<void> wait() {
......
...@@ -88,9 +88,7 @@ class BenchMouseRegionGridScroll extends WidgetRecorder { ...@@ -88,9 +88,7 @@ class BenchMouseRegionGridScroll extends WidgetRecorder {
} }
} }
class _UntilNextFrame { abstract final class _UntilNextFrame {
_UntilNextFrame._();
static Completer<void>? _completer; static Completer<void>? _completer;
static Future<void> wait() { static Future<void> wait() {
......
...@@ -4,11 +4,7 @@ ...@@ -4,11 +4,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class GalleryIcons { abstract final class GalleryIcons {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
GalleryIcons._();
static const IconData tooltip = IconData(0xe900, fontFamily: 'GalleryIcons'); static const IconData tooltip = IconData(0xe900, fontFamily: 'GalleryIcons');
static const IconData text_fields_alt = IconData(0xe901, fontFamily: 'GalleryIcons'); static const IconData text_fields_alt = IconData(0xe901, fontFamily: 'GalleryIcons');
static const IconData tabs = IconData(0xe902, fontFamily: 'GalleryIcons'); static const IconData tabs = IconData(0xe902, fontFamily: 'GalleryIcons');
......
...@@ -1353,11 +1353,7 @@ class ElasticInOutCurve extends Curve { ...@@ -1353,11 +1353,7 @@ class ElasticInOutCurve extends Curve {
/// ///
/// * [Curve], the interface implemented by the constants available from the /// * [Curve], the interface implemented by the constants available from the
/// [Curves] class. /// [Curves] class.
class Curves { abstract final class Curves {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
Curves._();
/// A linear animation curve. /// A linear animation curve.
/// ///
/// This is the identity map over the unit interval: its [Curve.transform] /// This is the identity map over the unit interval: its [Curve.transform]
......
...@@ -37,11 +37,7 @@ import 'theme.dart'; ...@@ -37,11 +37,7 @@ import 'theme.dart';
/// ### Background Colors /// ### Background Colors
/// ![](https://flutter.github.io/assets-for-api-docs/assets/cupertino/cupertino_background_colors.png) /// ![](https://flutter.github.io/assets-for-api-docs/assets/cupertino/cupertino_background_colors.png)
/// ///
class CupertinoColors { abstract final class CupertinoColors {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
CupertinoColors._();
/// iOS 13's default blue color. Used to indicate active elements such as /// iOS 13's default blue color. Used to indicate active elements such as
/// buttons, selected tabs and your own chat bubbles. /// buttons, selected tabs and your own chat bubbles.
/// ///
......
...@@ -60,11 +60,7 @@ import 'package:flutter/widgets.dart'; ...@@ -60,11 +60,7 @@ import 'package:flutter/widgets.dart';
/// ///
/// * [Icon], used to show these icons. /// * [Icon], used to show these icons.
@staticIconProvider @staticIconProvider
class CupertinoIcons { abstract final class CupertinoIcons {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
CupertinoIcons._();
/// The icon font used for Cupertino icons. /// The icon font used for Cupertino icons.
static const String iconFont = 'CupertinoIcons'; static const String iconFont = 'CupertinoIcons';
......
...@@ -282,11 +282,7 @@ class LicenseEntryWithLineBreaks extends LicenseEntry { ...@@ -282,11 +282,7 @@ class LicenseEntryWithLineBreaks extends LicenseEntry {
/// uses this API to select licenses to show. /// uses this API to select licenses to show.
/// * [AboutListTile], which is a widget that can be added to a [Drawer]. When /// * [AboutListTile], which is a widget that can be added to a [Drawer]. When
/// tapped it calls [showAboutDialog]. /// tapped it calls [showAboutDialog].
class LicenseRegistry { abstract final class LicenseRegistry {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
LicenseRegistry._();
static List<LicenseEntryCollector>? _collectors; static List<LicenseEntryCollector>? _collectors;
/// Adds licenses to the registry. /// Adds licenses to the registry.
......
...@@ -10,10 +10,7 @@ ...@@ -10,10 +10,7 @@
/// ///
/// * <http://unicode.org/reports/tr9/>, which describes the Unicode /// * <http://unicode.org/reports/tr9/>, which describes the Unicode
/// bidirectional text algorithm. /// bidirectional text algorithm.
class Unicode { abstract final class Unicode {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
Unicode._();
/// `U+202A LEFT-TO-RIGHT EMBEDDING` /// `U+202A LEFT-TO-RIGHT EMBEDDING`
/// ///
/// Treat the following text as embedded left-to-right. /// Treat the following text as embedded left-to-right.
......
...@@ -37,11 +37,7 @@ int _synthesiseDownButtons(int buttons, PointerDeviceKind kind) { ...@@ -37,11 +37,7 @@ int _synthesiseDownButtons(int buttons, PointerDeviceKind kind) {
/// This takes [PointerDataPacket] objects, as received from the engine via /// This takes [PointerDataPacket] objects, as received from the engine via
/// [dart:ui.PlatformDispatcher.onPointerDataPacket], and converts them to /// [dart:ui.PlatformDispatcher.onPointerDataPacket], and converts them to
/// [PointerEvent] objects. /// [PointerEvent] objects.
class PointerEventConverter { abstract final class PointerEventConverter {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
PointerEventConverter._();
/// Expand the given packet of pointer data into a sequence of framework /// Expand the given packet of pointer data into a sequence of framework
/// pointer events. /// pointer events.
/// ///
......
...@@ -15,11 +15,7 @@ export 'package:vector_math/vector_math_64.dart' show Matrix4; ...@@ -15,11 +15,7 @@ export 'package:vector_math/vector_math_64.dart' show Matrix4;
export 'events.dart' show PointerEvent; export 'events.dart' show PointerEvent;
/// An object that can hit-test pointers. /// An object that can hit-test pointers.
abstract class HitTestable { abstract interface class HitTestable {
// This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension.
HitTestable._();
/// Check whether the given position hits this object. /// Check whether the given position hits this object.
/// ///
/// If this given position hits this object, consider adding a [HitTestEntry] /// If this given position hits this object, consider adding a [HitTestEntry]
...@@ -28,21 +24,13 @@ abstract class HitTestable { ...@@ -28,21 +24,13 @@ abstract class HitTestable {
} }
/// An object that can dispatch events. /// An object that can dispatch events.
abstract class HitTestDispatcher { abstract interface class HitTestDispatcher {
// This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension.
HitTestDispatcher._();
/// Override this method to dispatch events. /// Override this method to dispatch events.
void dispatchEvent(PointerEvent event, HitTestResult result); void dispatchEvent(PointerEvent event, HitTestResult result);
} }
/// An object that can handle events. /// An object that can handle events.
abstract class HitTestTarget { abstract interface class HitTestTarget {
// This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension.
HitTestTarget._();
/// Override this method to receive events. /// Override this method to receive events.
void handleEvent(PointerEvent event, HitTestEntry<HitTestTarget> entry); void handleEvent(PointerEvent event, HitTestEntry<HitTestTarget> entry);
} }
......
...@@ -24,11 +24,7 @@ part of material_animated_icons; // ignore: use_string_in_part_of_directives ...@@ -24,11 +24,7 @@ part of material_animated_icons; // ignore: use_string_in_part_of_directives
/// See also: /// See also:
/// ///
/// * [Icons], for the list of available static Material Icons. /// * [Icons], for the list of available static Material Icons.
abstract class AnimatedIcons { abstract final class AnimatedIcons {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
AnimatedIcons._();
/// The Material Design add to event icon animation. /// The Material Design add to event icon animation.
/// ///
/// {@animation 72 72 https://flutter.github.io/assets-for-api-docs/assets/widgets/add_event.mp4} /// {@animation 72 72 https://flutter.github.io/assets-for-api-docs/assets/widgets/add_event.mp4}
......
...@@ -62,11 +62,7 @@ const Icon _kDefaultDeleteIcon = Icon(Icons.cancel, size: _kDeleteIconSize); ...@@ -62,11 +62,7 @@ const Icon _kDefaultDeleteIcon = Icon(Icons.cancel, size: _kDeleteIconSize);
/// * [FilterChip], uses tags or descriptive words as a way to filter content. /// * [FilterChip], uses tags or descriptive words as a way to filter content.
/// * [ActionChip], represents an action related to primary content. /// * [ActionChip], represents an action related to primary content.
/// * <https://material.io/design/components/chips.html> /// * <https://material.io/design/components/chips.html>
abstract class ChipAttributes { abstract interface class ChipAttributes {
// This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension.
ChipAttributes._();
/// The primary content of the chip. /// The primary content of the chip.
/// ///
/// Typically a [Text] widget. /// Typically a [Text] widget.
...@@ -214,11 +210,7 @@ abstract class ChipAttributes { ...@@ -214,11 +210,7 @@ abstract class ChipAttributes {
/// as an entity (person, place, or thing) or conversational text, in a /// as an entity (person, place, or thing) or conversational text, in a
/// compact form. /// compact form.
/// * <https://material.io/design/components/chips.html> /// * <https://material.io/design/components/chips.html>
abstract class DeletableChipAttributes { abstract interface class DeletableChipAttributes {
// This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension.
DeletableChipAttributes._();
/// The icon displayed when [onDeleted] is set. /// The icon displayed when [onDeleted] is set.
/// ///
/// Defaults to an [Icon] widget set to use [Icons.cancel]. /// Defaults to an [Icon] widget set to use [Icons.cancel].
...@@ -284,11 +276,7 @@ abstract class DeletableChipAttributes { ...@@ -284,11 +276,7 @@ abstract class DeletableChipAttributes {
/// compact form. /// compact form.
/// * [FilterChip], uses tags or descriptive words as a way to filter content. /// * [FilterChip], uses tags or descriptive words as a way to filter content.
/// * <https://material.io/design/components/chips.html> /// * <https://material.io/design/components/chips.html>
abstract class CheckmarkableChipAttributes { abstract interface class CheckmarkableChipAttributes {
// This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension.
CheckmarkableChipAttributes._();
/// Whether or not to show a check mark when /// Whether or not to show a check mark when
/// [SelectableChipAttributes.selected] is true. /// [SelectableChipAttributes.selected] is true.
/// ///
...@@ -319,11 +307,7 @@ abstract class CheckmarkableChipAttributes { ...@@ -319,11 +307,7 @@ abstract class CheckmarkableChipAttributes {
/// chips contain related descriptive text or categories. /// chips contain related descriptive text or categories.
/// * [FilterChip], uses tags or descriptive words as a way to filter content. /// * [FilterChip], uses tags or descriptive words as a way to filter content.
/// * <https://material.io/design/components/chips.html> /// * <https://material.io/design/components/chips.html>
abstract class SelectableChipAttributes { abstract interface class SelectableChipAttributes {
// This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension.
SelectableChipAttributes._();
/// Whether or not this chip is selected. /// Whether or not this chip is selected.
/// ///
/// If [onSelected] is not null, this value will be used to determine if the /// If [onSelected] is not null, this value will be used to determine if the
...@@ -429,11 +413,7 @@ abstract class SelectableChipAttributes { ...@@ -429,11 +413,7 @@ abstract class SelectableChipAttributes {
/// chips contain related descriptive text or categories. /// chips contain related descriptive text or categories.
/// * [FilterChip], uses tags or descriptive words as a way to filter content. /// * [FilterChip], uses tags or descriptive words as a way to filter content.
/// * <https://material.io/design/components/chips.html> /// * <https://material.io/design/components/chips.html>
abstract class DisabledChipAttributes { abstract interface class DisabledChipAttributes {
// This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension.
DisabledChipAttributes._();
/// Whether or not this chip is enabled for input. /// Whether or not this chip is enabled for input.
/// ///
/// If this is true, but all of the user action callbacks are null (i.e. /// If this is true, but all of the user action callbacks are null (i.e.
...@@ -477,11 +457,7 @@ abstract class DisabledChipAttributes { ...@@ -477,11 +457,7 @@ abstract class DisabledChipAttributes {
/// * [FilterChip], uses tags or descriptive words as a way to filter content. /// * [FilterChip], uses tags or descriptive words as a way to filter content.
/// * [ActionChip], represents an action related to primary content. /// * [ActionChip], represents an action related to primary content.
/// * <https://material.io/design/components/chips.html> /// * <https://material.io/design/components/chips.html>
abstract class TappableChipAttributes { abstract interface class TappableChipAttributes {
// This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension.
TappableChipAttributes._();
/// Called when the user taps the chip. /// Called when the user taps the chip.
/// ///
/// If [onPressed] is set, then this callback will be called when the user /// If [onPressed] is set, then this callback will be called when the user
......
...@@ -190,11 +190,7 @@ class MaterialAccentColor extends ColorSwatch<int> { ...@@ -190,11 +190,7 @@ class MaterialAccentColor extends ColorSwatch<int> {
/// See also: /// See also:
/// ///
/// * Cookbook: [Use themes to share colors and font styles](https://flutter.dev/docs/cookbook/design/themes) /// * Cookbook: [Use themes to share colors and font styles](https://flutter.dev/docs/cookbook/design/themes)
class Colors { abstract final class Colors {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
Colors._();
/// Completely invisible. /// Completely invisible.
static const Color transparent = Color(0x00000000); static const Color transparent = Color(0x00000000);
......
...@@ -7,11 +7,7 @@ import 'package:flutter/foundation.dart'; ...@@ -7,11 +7,7 @@ import 'package:flutter/foundation.dart';
import 'material_localizations.dart'; import 'material_localizations.dart';
/// Utility functions for working with dates. /// Utility functions for working with dates.
class DateUtils { abstract final class DateUtils {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
DateUtils._();
/// Returns a [DateTime] with the date of the original, but time set to /// Returns a [DateTime] with the date of the original, but time set to
/// midnight. /// midnight.
static DateTime dateOnly(DateTime date) { static DateTime dateOnly(DateTime date) {
......
...@@ -11,11 +11,7 @@ import 'theme.dart'; ...@@ -11,11 +11,7 @@ import 'theme.dart';
/// A utility class for dealing with the overlay color needed /// A utility class for dealing with the overlay color needed
/// to indicate elevation of surfaces. /// to indicate elevation of surfaces.
class ElevationOverlay { abstract final class ElevationOverlay {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
ElevationOverlay._();
/// Applies a surface tint color to a given container color to indicate /// Applies a surface tint color to a given container color to indicate
/// the level of its elevation. /// the level of its elevation.
/// ///
......
...@@ -81,11 +81,7 @@ import 'theme.dart'; ...@@ -81,11 +81,7 @@ import 'theme.dart';
/// } /// }
/// ``` /// ```
/// {@end-tool} /// {@end-tool}
class Feedback { abstract final class Feedback {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
Feedback._();
/// Provides platform-specific feedback for a tap. /// Provides platform-specific feedback for a tap.
/// ///
/// On Android the click system sound is played. On iOS this is a no-op. /// On Android the click system sound is played. On iOS this is a no-op.
......
...@@ -10,7 +10,7 @@ import 'package:flutter/widgets.dart'; ...@@ -10,7 +10,7 @@ import 'package:flutter/widgets.dart';
/// A set of platform-adaptive Material Design icons. /// A set of platform-adaptive Material Design icons.
/// ///
/// Use [Icons.adaptive] to access a static instance of this class. /// Use [Icons.adaptive] to access a static instance of this class.
class PlatformAdaptiveIcons implements Icons { final class PlatformAdaptiveIcons implements Icons {
const PlatformAdaptiveIcons._(); const PlatformAdaptiveIcons._();
static bool _isCupertino() { static bool _isCupertino() {
...@@ -150,11 +150,7 @@ class PlatformAdaptiveIcons implements Icons { ...@@ -150,11 +150,7 @@ class PlatformAdaptiveIcons implements Icons {
/// * <https://material.io/resources/icons> /// * <https://material.io/resources/icons>
/// * [AnimatedIcons], for the list of available animated Material Icons. /// * [AnimatedIcons], for the list of available animated Material Icons.
@staticIconProvider @staticIconProvider
class Icons { abstract final class Icons {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
Icons._();
/// A set of platform-adaptive Material Design icons. /// A set of platform-adaptive Material Design icons.
/// ///
/// Provides a convenient way to show a certain set of platform-appropriate /// Provides a convenient way to show a certain set of platform-appropriate
...@@ -8,11 +8,7 @@ import 'package:vector_math/vector_math_64.dart'; ...@@ -8,11 +8,7 @@ import 'package:vector_math/vector_math_64.dart';
import 'basic_types.dart'; import 'basic_types.dart';
/// Utility functions for working with matrices. /// Utility functions for working with matrices.
class MatrixUtils { abstract final class MatrixUtils {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
MatrixUtils._();
/// Returns the given [transform] matrix as an [Offset], if the matrix is /// Returns the given [transform] matrix as an [Offset], if the matrix is
/// nothing but a 2D translation. /// nothing but a 2D translation.
/// ///
......
...@@ -17,11 +17,7 @@ typedef ChildLayouter = Size Function(RenderBox child, BoxConstraints constraint ...@@ -17,11 +17,7 @@ typedef ChildLayouter = Size Function(RenderBox child, BoxConstraints constraint
/// given set of [BoxConstraints]. /// given set of [BoxConstraints].
/// ///
/// All of the functions adhere to the [ChildLayouter] signature. /// All of the functions adhere to the [ChildLayouter] signature.
class ChildLayoutHelper { abstract final class ChildLayoutHelper {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
const ChildLayoutHelper._();
/// Returns the [Size] that the [RenderBox] would have if it were to /// Returns the [Size] that the [RenderBox] would have if it were to
/// be laid out with the given [BoxConstraints]. /// be laid out with the given [BoxConstraints].
/// ///
......
...@@ -206,9 +206,7 @@ mixin SelectionRegistrant on Selectable { ...@@ -206,9 +206,7 @@ mixin SelectionRegistrant on Selectable {
} }
/// A utility class that provides useful methods for handling selection events. /// A utility class that provides useful methods for handling selection events.
class SelectionUtils { abstract final class SelectionUtils {
SelectionUtils._();
/// Determines [SelectionResult] purely based on the target rectangle. /// Determines [SelectionResult] purely based on the target rectangle.
/// ///
/// This method returns [SelectionResult.end] if the `point` is inside the /// This method returns [SelectionResult.end] if the `point` is inside the
......
...@@ -29,11 +29,7 @@ enum CacheExtentStyle { ...@@ -29,11 +29,7 @@ enum CacheExtentStyle {
/// content, which can be controlled by a [ViewportOffset]. This interface lets /// content, which can be controlled by a [ViewportOffset]. This interface lets
/// the framework recognize such render objects and interact with them without /// the framework recognize such render objects and interact with them without
/// having specific knowledge of all the various types of viewports. /// having specific knowledge of all the various types of viewports.
abstract class RenderAbstractViewport extends RenderObject { abstract interface class RenderAbstractViewport extends RenderObject {
// This class is intended to be used as an interface, and should not be
// extended directly; this constructor prevents instantiation and extension.
RenderAbstractViewport._();
/// Returns the [RenderAbstractViewport] that most tightly encloses the given /// Returns the [RenderAbstractViewport] that most tightly encloses the given
/// render object. /// render object.
/// ///
......
...@@ -17,11 +17,7 @@ export 'dart:ui' show TextDirection; ...@@ -17,11 +17,7 @@ export 'dart:ui' show TextDirection;
/// ///
/// When possible, prefer using mechanisms like [Semantics] to implicitly /// When possible, prefer using mechanisms like [Semantics] to implicitly
/// trigger announcements over using this event. /// trigger announcements over using this event.
class SemanticsService { abstract final class SemanticsService {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
SemanticsService._();
/// Sends a semantic announcement. /// Sends a semantic announcement.
/// ///
/// This should be used for announcement that are not seamlessly announced by /// This should be used for announcement that are not seamlessly announced by
......
...@@ -21,11 +21,7 @@ class ClipboardData { ...@@ -21,11 +21,7 @@ class ClipboardData {
} }
/// Utility methods for interacting with the system's clipboard. /// Utility methods for interacting with the system's clipboard.
class Clipboard { abstract final class Clipboard {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
Clipboard._();
// Constants for common [getData] [format] types. // Constants for common [getData] [format] types.
/// Plain text data format string. /// Plain text data format string.
......
...@@ -24,11 +24,7 @@ import 'system_channels.dart'; ...@@ -24,11 +24,7 @@ import 'system_channels.dart';
/// Deferred components are currently an Android-only feature. The methods in /// Deferred components are currently an Android-only feature. The methods in
/// this class are a no-op and all assets and dart code are already available /// this class are a no-op and all assets and dart code are already available
/// without installation if called on other platforms. /// without installation if called on other platforms.
class DeferredComponent { abstract final class DeferredComponent {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
DeferredComponent._();
// TODO(garyq): We should eventually expand this to install components by loadingUnitId // TODO(garyq): We should eventually expand this to install components by loadingUnitId
// as well as componentName, but currently, loadingUnitId is opaque to the dart code // as well as componentName, but currently, loadingUnitId is opaque to the dart code
// so this is not possible. The API has been left flexible to allow adding // so this is not possible. The API has been left flexible to allow adding
......
...@@ -9,11 +9,7 @@ import 'system_channels.dart'; ...@@ -9,11 +9,7 @@ import 'system_channels.dart';
/// ///
/// This API is intentionally terse since it calls default platform behavior. It /// This API is intentionally terse since it calls default platform behavior. It
/// is not suitable for precise control of the system's haptic feedback module. /// is not suitable for precise control of the system's haptic feedback module.
class HapticFeedback { abstract final class HapticFeedback {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
HapticFeedback._();
/// Provides vibration haptic feedback to the user for a short duration. /// Provides vibration haptic feedback to the user for a short duration.
/// ///
/// On iOS devices that support haptic feedback, this uses the default system /// On iOS devices that support haptic feedback, this uses the default system
......
...@@ -340,10 +340,7 @@ class MethodChannel { ...@@ -340,10 +340,7 @@ class MethodChannel {
/// <https://flutter.dev/developing-packages/>: /// <https://flutter.dev/developing-packages/>:
/// ///
/// ```dart /// ```dart
/// class Music { /// abstract final class Music {
/// // Class cannot be instantiated.
/// const Music._();
///
/// static const MethodChannel _channel = MethodChannel('music'); /// static const MethodChannel _channel = MethodChannel('music');
/// ///
/// static Future<bool> isLicensed() async { /// static Future<bool> isLicensed() async {
......
...@@ -10,11 +10,7 @@ import 'platform_channel.dart'; ...@@ -10,11 +10,7 @@ import 'platform_channel.dart';
export 'platform_channel.dart' show BasicMessageChannel, MethodChannel; export 'platform_channel.dart' show BasicMessageChannel, MethodChannel;
/// Platform channels used by the Flutter system. /// Platform channels used by the Flutter system.
class SystemChannels { abstract final class SystemChannels {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
SystemChannels._();
/// A JSON [MethodChannel] for navigation. /// A JSON [MethodChannel] for navigation.
/// ///
/// The following incoming methods are defined for this channel (registered /// The following incoming methods are defined for this channel (registered
......
...@@ -358,11 +358,7 @@ List<String> _stringify(List<dynamic> list) => <String>[ ...@@ -358,11 +358,7 @@ List<String> _stringify(List<dynamic> list) => <String>[
/// Controls specific aspects of the operating system's graphical interface and /// Controls specific aspects of the operating system's graphical interface and
/// how it interacts with the application. /// how it interacts with the application.
class SystemChrome { abstract final class SystemChrome {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
SystemChrome._();
/// Specifies the set of orientations the application interface can /// Specifies the set of orientations the application interface can
/// be displayed in. /// be displayed in.
/// ///
......
...@@ -5,11 +5,7 @@ ...@@ -5,11 +5,7 @@
import 'system_channels.dart'; import 'system_channels.dart';
/// Controls specific aspects of the system navigation stack. /// Controls specific aspects of the system navigation stack.
class SystemNavigator { abstract final class SystemNavigator {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
SystemNavigator._();
/// Removes the topmost Flutter instance, presenting what was before /// Removes the topmost Flutter instance, presenting what was before
/// it. /// it.
/// ///
......
...@@ -26,11 +26,7 @@ enum SystemSoundType { ...@@ -26,11 +26,7 @@ enum SystemSoundType {
/// Provides access to the library of short system specific sounds for common /// Provides access to the library of short system specific sounds for common
/// tasks. /// tasks.
class SystemSound { abstract final class SystemSound {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
SystemSound._();
/// Play the specified system sound. If that sound is not present on the /// Play the specified system sound. If that sound is not present on the
/// system, the call is ignored. /// system, the call is ignored.
/// ///
......
...@@ -3,6 +3,4 @@ ...@@ -3,6 +3,4 @@
// found in the LICENSE file. // found in the LICENSE file.
/// Placeholder to be used in a future version of Flutter. /// Placeholder to be used in a future version of Flutter.
abstract class Window { abstract final class Window { }
const Window._();
}
...@@ -79,11 +79,7 @@ Future<PortForwarder> _dummyPortForwardingFunction( ...@@ -79,11 +79,7 @@ Future<PortForwarder> _dummyPortForwardingFunction(
/// [FuchsiaRemoteConnection.connect] whereby the `FUCHSIA_REMOTE_URL` and /// [FuchsiaRemoteConnection.connect] whereby the `FUCHSIA_REMOTE_URL` and
/// `FUCHSIA_SSH_CONFIG` variables must be set. If run on a Fuchsia device, will /// `FUCHSIA_SSH_CONFIG` variables must be set. If run on a Fuchsia device, will
/// connect locally without need for environment variables. /// connect locally without need for environment variables.
class FuchsiaCompat { abstract final class FuchsiaCompat {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
FuchsiaCompat._();
static void _init() { static void _init() {
fuchsiaPortForwardingFunction = _dummyPortForwardingFunction; fuchsiaPortForwardingFunction = _dummyPortForwardingFunction;
} }
......
...@@ -38,11 +38,7 @@ String? _keyLabel(LogicalKeyboardKey key) { ...@@ -38,11 +38,7 @@ String? _keyLabel(LogicalKeyboardKey key) {
/// A class that serves as a namespace for a bunch of keyboard-key generation /// A class that serves as a namespace for a bunch of keyboard-key generation
/// utilities. /// utilities.
class KeyEventSimulator { abstract final class KeyEventSimulator {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
KeyEventSimulator._();
// Look up a synonym key, and just return the left version of it. // Look up a synonym key, and just return the left version of it.
static LogicalKeyboardKey _getKeySynonym(LogicalKeyboardKey origKey) { static LogicalKeyboardKey _getKeySynonym(LogicalKeyboardKey origKey) {
if (origKey == LogicalKeyboardKey.shift) { if (origKey == LogicalKeyboardKey.shift) {
......
...@@ -44,10 +44,7 @@ class _AsyncScope { ...@@ -44,10 +44,7 @@ class _AsyncScope {
/// // ... /// // ...
/// }); /// });
/// ``` /// ```
class TestAsyncUtils { abstract final class TestAsyncUtils {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
TestAsyncUtils._();
static const String _className = 'TestAsyncUtils'; static const String _className = 'TestAsyncUtils';
static final List<_AsyncScope> _scopeStack = <_AsyncScope>[]; static final List<_AsyncScope> _scopeStack = <_AsyncScope>[];
......
...@@ -394,10 +394,7 @@ abstract class CopyFlutterAotBundle extends Target { ...@@ -394,10 +394,7 @@ abstract class CopyFlutterAotBundle extends Target {
} }
/// Lipo CLI tool wrapper shared by iOS and macOS builds. /// Lipo CLI tool wrapper shared by iOS and macOS builds.
class Lipo { abstract final class Lipo {
/// Static only.
Lipo._();
/// Create a "fat" binary by combining multiple architecture-specific ones. /// Create a "fat" binary by combining multiple architecture-specific ones.
/// `skipMissingInputs` can be changed to `true` to first check whether /// `skipMissingInputs` can be changed to `true` to first check whether
/// the expected input paths exist and ignore the command if they don't. /// the expected input paths exist and ignore the command if they don't.
......
...@@ -100,10 +100,7 @@ Future<void> pollForServiceExtensionValue<T>({ ...@@ -100,10 +100,7 @@ Future<void> pollForServiceExtensionValue<T>({
); );
} }
class AppleTestUtils { abstract final class AppleTestUtils {
// static only
AppleTestUtils._();
static const List<String> requiredSymbols = <String>[ static const List<String> requiredSymbols = <String>[
'_kDartIsolateSnapshotData', '_kDartIsolateSnapshotData',
'_kDartIsolateSnapshotInstructions', '_kDartIsolateSnapshotInstructions',
......
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