From 713b0239425d0bf960aa4905b8c2a692c472a8a2 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 16 Jul 2026 14:44:29 +0000 Subject: [PATCH 1/3] test: add equality check for AsyncButtonTheme empty constant Adds a test to ensure that the `AsyncButtonTheme.empty` constant has correct value-based equality against a new default instance `AsyncButtonTheme()`, preventing regressions. --- test/material_async_button_theme_test.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/material_async_button_theme_test.dart b/test/material_async_button_theme_test.dart index 522f630..5d3d44c 100644 --- a/test/material_async_button_theme_test.dart +++ b/test/material_async_button_theme_test.dart @@ -106,5 +106,12 @@ void main() { check(a).equals(b); check(a.hashCode).equals(b.hashCode); }); + + test('empty equality is value-based', () { + const a = AsyncButtonTheme.empty; + const b = AsyncButtonTheme(); + check(a).equals(b); + check(a.hashCode).equals(b.hashCode); + }); }); } From 91fce66db83742091eec16c7c6140f2546361b2c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 16 Jul 2026 14:50:20 +0000 Subject: [PATCH 2/3] test: fix CI lint failure by suppressing use_named_constants Added `// ignore: use_named_constants` because testing the equality operator requires us to create a new `AsyncButtonTheme()` instance, which the linter warns about since `AsyncButtonTheme.empty` exists. --- test/material_async_button_theme_test.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/test/material_async_button_theme_test.dart b/test/material_async_button_theme_test.dart index 5d3d44c..8cb7e43 100644 --- a/test/material_async_button_theme_test.dart +++ b/test/material_async_button_theme_test.dart @@ -109,6 +109,7 @@ void main() { test('empty equality is value-based', () { const a = AsyncButtonTheme.empty; + // ignore: use_named_constants, intentional for testing equality to empty instance const b = AsyncButtonTheme(); check(a).equals(b); check(a.hashCode).equals(b.hashCode); From 5725209f3036b24a870501a6320fc07db70d62bf Mon Sep 17 00:00:00 2001 From: Mehmet Esen Date: Sun, 19 Jul 2026 16:20:57 +0300 Subject: [PATCH 3/3] test: assert empty's field defaults, not const canonicalization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test as written passed via const canonicalization: `empty` is itself `const AsyncButtonTheme()`, so both sides were the same canonical object and `==` short-circuited on `identical` without comparing a field. Assert the fields directly so the invariant is actually pinned. Also fixes the suppression comment — everything after `// ignore:` is parsed as further diagnostic names, so the prose reason was sitting in the rule-name slot. Moved above the directive. Claude-Session: https://claude.ai/code/session_016CksHun59R73nc5XdxJENS --- test/material_async_button_theme_test.dart | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/material_async_button_theme_test.dart b/test/material_async_button_theme_test.dart index c9961ae..5f2b08a 100644 --- a/test/material_async_button_theme_test.dart +++ b/test/material_async_button_theme_test.dart @@ -115,12 +115,15 @@ void main() { check(a.hashCode).equals(b.hashCode); }); - test('empty equality is value-based', () { - const a = AsyncButtonTheme.empty; - // ignore: use_named_constants, intentional for testing equality to empty instance + test('empty leaves every field at its default', () { + // `empty` is itself `const AsyncButtonTheme()`, so the equality below is + // satisfied by const canonicalization alone. The field checks are what + // actually pin the invariant: `empty` must never grow a set field. + // ignore: use_named_constants const b = AsyncButtonTheme(); - check(a).equals(b); - check(a.hashCode).equals(b.hashCode); + check(AsyncButtonTheme.empty).equals(b); + check(AsyncButtonTheme.empty.loadingBuilder).isNull(); + check(AsyncButtonTheme.empty.transitionBuilder).isNull(); }); }); }