Repository: dart-lang/pub-dev (dart)

Issue:
Remove null-safety from pub.dev package versions
The newer Dart SDKs are not supporting non-null-safe code anymore, but our UI still displays null-safety status of packages:

<img width="829" height="1035" alt="Image" src="https://github.com/user-attachments/assets/47d8f2aa-4ccc-4d5a-a0d7-ff3916c485c9" />

By this point it's just UI clutter, so I propose we remove it.

cc @sigurdm

Pull request:
Closes #8960.

Patch:
diff --git a/app/lib/frontend/templates/package_misc.dart b/app/lib/frontend/templates/package_misc.dart
index 5735c03b19..02175f17ac 100644
--- a/app/lib/frontend/templates/package_misc.dart
+++ b/app/lib/frontend/templates/package_misc.dart
@@ -35,14 +35,6 @@ final nameMatchBadgeNode = packageBadgeNode(
   color: 'name-match',
 );
 
-/// Renders the null-safe badge used by package listing and package page.
-d.Node nullSafeBadgeNode({String? title}) {
-  return packageBadgeNode(
-    label: 'Null safety',
-    title: title ?? 'Supports the null safety language feature.',
-  );
-}
-
 /// Renders the Dart 3 compatible badge.
 final dart3CompatibleNode = packageBadgeNode(
   label: 'Dart 3 compatible',
diff --git a/app/lib/frontend/templates/views/pkg/header.dart b/app/lib/frontend/templates/views/pkg/header.dart
index 2a0398b27e..6cd9dccdbe 100644
--- a/app/lib/frontend/templates/views/pkg/header.dart
+++ b/app/lib/frontend/templates/views/pkg/header.dart
@@ -22,7 +22,6 @@ d.Node packageHeaderNode({
     d.span(child: d.xAgoTimestamp(published)),
     d.text(' '),
     if (publisherId != null) ..._publisher(publisherId),
-    if (isNullSafe && !isDart3Compatible) nullSafeBadgeNode(),
     if (isDart3Compatible) dart3CompatibleNode,
     if (isDart3Incompatible) dart3IncompatibleNode,
     if (releases != null) ..._releases(packageName, releases),
diff --git a/app/lib/frontend/templates/views/pkg/package_list.dart b/app/lib/frontend/templates/views/pkg/package_list.dart
index a4c0874824..92690f6bff 100644
--- a/app/lib/frontend/templates/views/pkg/package_list.dart
+++ b/app/lib/frontend/templates/views/pkg/package_list.dart
@@ -73,7 +73,6 @@ d.Node _sdkLibraryItem(SdkLibraryHit hit) {
         text: sdkDict.libraryTypeLabel,
       ),
       coreLibraryBadgeNode,
-      nullSafeBadgeNode(),
     ]),
     tagsNode: null,
     replacedBy: null,
@@ -94,7 +93,6 @@ d.Node _packageItem(
   required bool isLiked,
 }) {
   final isFlutterFavorite = view.tags.contains(PackageTags.isFlutterFavorite);
-  final isNullSafe = view.tags.contains(PackageVersionTags.isNullSafe);
   final isDart3Compatible = view.tags.contains(
     PackageVersionTags.isDart3Compatible,
   );
@@ -157,7 +155,6 @@ d.Node _packageItem(
     if (licenseNode != null)
       d.span(classes: ['packages-metadata-block'], child: licenseNode),
     if (isFlutterFavorite) flutterFavoriteBadgeNode,
-    if (isNullSafe && !isDart3Compatible) nullSafeBadgeNode(),
     if (isDart3Compatible) dart3CompatibleNode,
     if (isDart3Incompatible) dart3IncompatibleNode,
   ]);
diff --git a/app/lib/frontend/templates/views/pkg/versions/version_row.dart b/app/lib/frontend/templates/views/pkg/versions/version_row.dart
index 4ca48587cb..b0e9cff84b 100644
--- a/app/lib/frontend/templates/views/pkg/versions/version_row.dart
+++ b/app/lib/frontend/templates/views/pkg/versions/version_row.dart
@@ -9,7 +9,6 @@ import '../../../../../package/model_properties.dart';
 import '../../../../../shared/urls.dart' as urls;
 import '../../../../dom/dom.dart' as d;
 import '../../../../static_files.dart';
-import '../../../package_misc.dart';
 
 d.Node versionRowNode(
   String package,
@@ -29,14 +28,7 @@ d.Node versionRowNode(
           title: 'Visit $package ${version.version} page',
         ),
       ),
-      d.td(
-        classes: ['badge'],
-        child: pubspec.hasOptedIntoNullSafety
-            ? nullSafeBadgeNode(
-                title: 'Package version is opted into null safety.',
-              )
-            : null,
-      ),
+      d.td(classes: ['badge'], child: null),
       d.td(
         classes: ['sdk'],
         child: sdk != null


Test patch:
diff --git a/app/test/frontend/golden/pkg_index_page.html b/app/test/frontend/golden/pkg_index_page.html
index d07692a691..bd8fe6c3ee 100644
--- a/app/test/frontend/golden/pkg_index_page.html
+++ b/app/test/frontend/golden/pkg_index_page.html
@@ -446,7 +446,6 @@ <h3 class="packages-title pub-monochrome-icon-hoverable">
                   <p class="packages-metadata">
                     <span class="packages-metadata-block">Dart SDK library</span>
                     <span class="package-badge">Core library</span>
-                    <span class="package-badge" title="Supports the null safety language feature.">Null safety</span>
                   </p>
                 </div>
               </div>
diff --git a/app/test/frontend/golden/pkg_versions_page.html b/app/test/frontend/golden/pkg_versions_page.html
index f3e51ffe3e..d704f9592e 100644
--- a/app/test/frontend/golden/pkg_versions_page.html
+++ b/app/test/frontend/golden/pkg_versions_page.html
@@ -249,9 +249,7 @@ <h2 id="stable">Stable versions of oxygen</h2>
                         <td class="version">
                           <a href="/packages/oxygen/versions/1.2.0" title="Visit oxygen 1.2.0 page">1.2.0</a>
                         </td>
-                        <td class="badge">
-                          <span class="package-badge" title="Package version is opted into null safety.">Null safety</span>
-                        </td>
+                        <td class="badge"></td>
                         <td class="sdk">3.0</td>
                         <td class="uploaded">
                           <a class="-x-ago" href="" title="%%version-created-date%%" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
@@ -271,9 +269,7 @@ <h2 id="stable">Stable versions of oxygen</h2>
                         <td class="version">
                           <a href="/packages/oxygen/versions/1.0.0" title="Visit oxygen 1.0.0 page">1.0.0</a>
                         </td>
-                        <td class="badge">
-                          <span class="package-badge" title="Package version is opted into null safety.">Null safety</span>
-                        </td>
+                        <td class="badge"></td>
                         <td class="sdk">3.0</td>
                         <td class="uploaded">
                           <a class="-x-ago" href="" title="%%version-created-date%%" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
@@ -316,9 +312,7 @@ <h2 id="prerelease">Prerelease versions of oxygen</h2>
                         <td class="version">
                           <a href="/packages/oxygen/versions/2.0.0-dev" title="Visit oxygen 2.0.0-dev page">2.0.0-dev</a>
                         </td>
-                        <td class="badge">
-                          <span class="package-badge" title="Package version is opted into null safety.">Null safety</span>
-                        </td>
+                        <td class="badge"></td>
                         <td class="sdk">3.0</td>
                         <td class="uploaded">
                           <a class="-x-ago" href="" title="%%version-created-date%%" role="button" data-timestamp="%%millis%%">%%x-ago%%</a>
diff --git a/app/test/task/testdata/goldens/packages/oxygen/versions.html b/app/test/task/testdata/goldens/packages/oxygen/versions.html
index 39ccd3a3d7..62714c3c21 100644
--- a/app/test/task/testdata/goldens/packages/oxygen/versions.html
+++ b/app/test/task/testdata/goldens/packages/oxygen/versions.html
@@ -235,9 +235,7 @@ <h2 id="stable">Stable versions of oxygen</h2>
                         <td class="version">
                           <a href="/packages/oxygen/versions/2.0.0" title="Visit oxygen 2.0.0 page">2.0.0</a>
                         </td>
-                        <td class="badge">
-                          <span class="package-badge" title="Package version is opted into null safety.">Null safety</span>
-                        </td>
+                        <td class="badge"></td>
                         <td class="sdk">3.0</td>
                         <td class="uploaded">
                           <a class="-x-ago" href="" title="%%short-dateformat%%" role="button" data-timestamp="%%time-ago-millis%%">%%time-ago%%</a>
@@ -257,9 +255,7 @@ <h2 id="stable">Stable versions of oxygen</h2>
                         <td class="version">
                           <a href="/packages/oxygen/versions/1.0.0" title="Visit oxygen 1.0.0 page">1.0.0</a>
                         </td>
-                        <td class="badge">
-                          <span class="package-badge" title="Package version is opted into null safety.">Null safety</span>
-                        </td>
+                        <td class="badge"></td>
                         <td class="sdk">3.0</td>
                         <td class="uploaded">
                           <a class="-x-ago" href="" title="%%short-dateformat%%" role="button" data-timestamp="%%time-ago-millis%%">%%time-ago%%</a>