diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/html/path/path_utils.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/html/path/path_utils.dart index ba539b8c79..302e19a058 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/html/path/path_utils.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/html/path/path_utils.dart @@ -26,7 +26,11 @@ class SPathVerb { static const int kClose = 5; // 0 points } -class SPath { +abstract class SPath { + // This class is not meant to be instantiated or extended; this constructor + // prevents instantiation and extension. + SPath._(); + static const int kMoveVerb = SPathVerb.kMove; static const int kLineVerb = SPathVerb.kLine; static const int kQuadVerb = SPathVerb.kQuad; diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/html/shaders/vertex_shaders.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/html/shaders/vertex_shaders.dart index c1248f9cb8..b2dd353abc 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/html/shaders/vertex_shaders.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/html/shaders/vertex_shaders.dart @@ -9,9 +9,12 @@ import 'package:ui/ui.dart' as ui; import '../../browser_detection.dart'; import 'shader_builder.dart'; -// ignore: avoid_classes_with_only_static_members /// Provides common shaders used for gradients and drawVertices APIs. -class VertexShaders { +abstract class VertexShaders { + // This class is not meant to be instantiated or extended; this constructor + // prevents instantiation and extension. + VertexShaders._(); + static final Uint16List vertexIndicesForRect = Uint16List.fromList([0, 1, 2, 2, 3, 0]); @@ -70,7 +73,11 @@ class VertexShaders { } } -class FragmentShaders { +abstract class FragmentShaders { + // This class is not meant to be instantiated or extended; this constructor + // prevents instantiation and extension. + FragmentShaders._(); + static String writeTextureFragmentShader( bool isWebGl2, ui.TileMode? tileModeX, ui.TileMode? tileModeY) { final ShaderBuilder builder = ShaderBuilder.fragment(webGLVersion); diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/text/word_breaker.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/text/word_breaker.dart index 34e2356ebc..d4610eb1e2 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/text/word_breaker.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/text/word_breaker.dart @@ -16,6 +16,10 @@ class _FindBreakDirection { /// [WordBreaker] exposes static methods to identify word boundaries. abstract class WordBreaker { + // This class is not meant to be instantiated or extended; this constructor + // prevents instantiation and extension. + WordBreaker._(); + /// It starts from [index] and tries to find the next word boundary in [text]. static int nextBreakIndex(String text, int index) => _findBreakIndex(_FindBreakDirection.forward, text, index); diff --git a/engine/src/flutter/lib/web_ui/lib/src/ui/hash_codes.dart b/engine/src/flutter/lib/web_ui/lib/src/ui/hash_codes.dart index f100ae5275..b94b22a33a 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/ui/hash_codes.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/ui/hash_codes.dart @@ -13,7 +13,11 @@ const _HashEnd _hashEnd = _HashEnd(); // Jenkins hash function, optimized for small integers. // // Borrowed from the dart sdk: sdk/lib/math/jenkins_smi_hash.dart. -class _Jenkins { +abstract class _Jenkins { + // This class is not meant to be instantiated or extended; this constructor + // prevents instantiation and extension. + _Jenkins._(); + static int combine(int hash, Object? o) { assert(o is! Iterable); hash = 0x1fffffff & (hash + o.hashCode);