[go: nahoru, domu]

Skip to content

Commit

Permalink
Fix classes that shouldn't be extended/instantiated/mixedin (flutter#…
Browse files Browse the repository at this point in the history
…39517)

* Fix classes that shouldn't be extended/instantiated/mixedin

* add ignore

* fix comment
  • Loading branch information
goderbauer committed Feb 9, 2023
1 parent 8f52c59 commit c3c7b24
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/ui/isolate_name_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ part of dart.ui;
/// recommended to establish a separate communication channel in that first
/// message (e.g. by passing a dedicated [SendPort]).
class IsolateNameServer {
// This class is only a namespace, and should not be instantiated or
// extended directly.
factory IsolateNameServer._() => throw UnsupportedError('Namespace');
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
IsolateNameServer._();

/// Looks up the [SendPort] associated with a given name.
///
Expand Down
4 changes: 4 additions & 0 deletions lib/ui/natives.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ part of dart.ui;

/// Helper functions for Dart Plugin Registrants.
class DartPluginRegistrant {
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
DartPluginRegistrant._();

static bool _wasInitialized = false;

/// Makes sure the that the Dart Plugin Registrant has been called for this
Expand Down
3 changes: 3 additions & 0 deletions lib/ui/painting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3501,6 +3501,9 @@ class _ColorFilter extends NativeFieldWrapperClass1 {
/// * [SceneBuilder.pushImageFilter], which is the low-level API for using
/// this class as a child layer filter.
abstract class ImageFilter {
// This class is not meant to be extended; this constructor prevents extension.
ImageFilter._(); // ignore: unused_element

/// Creates an image filter that applies a Gaussian blur.
factory ImageFilter.blur({ double sigmaX = 0.0, double sigmaY = 0.0, TileMode tileMode = TileMode.clamp }) {
return _GaussianBlurImageFilter(sigmaX: sigmaX, sigmaY: sigmaY, tileMode: tileMode);
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/plugins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class CallbackHandle {
/// * [IsolateNameServer], which provides utilities for dealing with
/// [Isolate]s.
class PluginUtilities {
// This class is only a namespace, and should not be instantiated or
// extended directly.
factory PluginUtilities._() => throw UnsupportedError('Namespace');
// This class is not meant to be instantiated or extended; this constructor
// prevents instantiation and extension.
PluginUtilities._();

static final Map<Function, CallbackHandle?> _forwardCache =
<Function, CallbackHandle?>{};
Expand Down

0 comments on commit c3c7b24

Please sign in to comment.