Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c3c7b24

Browse files
authored
Fix classes that shouldn't be extended/instantiated/mixedin (#39517)
* Fix classes that shouldn't be extended/instantiated/mixedin * add ignore * fix comment
1 parent 8f52c59 commit c3c7b24

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

lib/ui/isolate_name_server.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ part of dart.ui;
2020
/// recommended to establish a separate communication channel in that first
2121
/// message (e.g. by passing a dedicated [SendPort]).
2222
class IsolateNameServer {
23-
// This class is only a namespace, and should not be instantiated or
24-
// extended directly.
25-
factory IsolateNameServer._() => throw UnsupportedError('Namespace');
23+
// This class is not meant to be instantiated or extended; this constructor
24+
// prevents instantiation and extension.
25+
IsolateNameServer._();
2626

2727
/// Looks up the [SendPort] associated with a given name.
2828
///

lib/ui/natives.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ part of dart.ui;
77

88
/// Helper functions for Dart Plugin Registrants.
99
class DartPluginRegistrant {
10+
// This class is not meant to be instantiated or extended; this constructor
11+
// prevents instantiation and extension.
12+
DartPluginRegistrant._();
13+
1014
static bool _wasInitialized = false;
1115

1216
/// Makes sure the that the Dart Plugin Registrant has been called for this

lib/ui/painting.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3501,6 +3501,9 @@ class _ColorFilter extends NativeFieldWrapperClass1 {
35013501
/// * [SceneBuilder.pushImageFilter], which is the low-level API for using
35023502
/// this class as a child layer filter.
35033503
abstract class ImageFilter {
3504+
// This class is not meant to be extended; this constructor prevents extension.
3505+
ImageFilter._(); // ignore: unused_element
3506+
35043507
/// Creates an image filter that applies a Gaussian blur.
35053508
factory ImageFilter.blur({ double sigmaX = 0.0, double sigmaY = 0.0, TileMode tileMode = TileMode.clamp }) {
35063509
return _GaussianBlurImageFilter(sigmaX: sigmaX, sigmaY: sigmaY, tileMode: tileMode);

lib/ui/plugins.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class CallbackHandle {
4040
/// * [IsolateNameServer], which provides utilities for dealing with
4141
/// [Isolate]s.
4242
class PluginUtilities {
43-
// This class is only a namespace, and should not be instantiated or
44-
// extended directly.
45-
factory PluginUtilities._() => throw UnsupportedError('Namespace');
43+
// This class is not meant to be instantiated or extended; this constructor
44+
// prevents instantiation and extension.
45+
PluginUtilities._();
4646

4747
static final Map<Function, CallbackHandle?> _forwardCache =
4848
<Function, CallbackHandle?>{};

0 commit comments

Comments
 (0)