Repository: flutter
Issue: Talkback & VoiceOver Do not update custom semantics action after an action has been performed
Labels: platform-android,platform-ios,framework,a: accessibility,has reproducible steps,P2,team-framework,triaged-framework,found in release: 3.22,found in release: 3.23

### Steps to reproduce

Run the code provided
Turn on voiceOver or Talkback
Swipe up or down to hear "Increment 0"
Swipe up or down back to "Activate" or left and right to hear "increment button"
 Double click the increment button
Swipe up or down at the Increment button to hear "Increment Number"

### Expected results

VoiceOver and Talkback should say Increment 1, Increment 2 and so on when You will again swipe up or down at the increment button after each click the button.

### Actual results

VoiceOver and Talkback always say Increment 0 when you swipe up or down to choose action. When you touch the screen two fingers on Android to show Actions, You will see Increment 0 instead of Increment CurrentValue


### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;
  void _incrementCounter({int? num}) {
    setState(() {
      _counter += num??1;
    });
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
		  ],
        ),
      ),
      floatingActionButton: Semantics(excludeSemantics: true, // avoiding duplicate controls
 button: true, // emitsVoiceOver button information
customSemanticsActions: {CustomSemanticsAction(label: "Increment  $_counter"): () => _incrementCounter(num: _counter)}, // should increment a value of _counter with previous _counter after choosing action by swiping up or down
label: 'increment', // a VoiceOver button's label added here because of Excluding Semantics
 child: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      )), 
    );
  }
}
```

</details>


### Screenshots or Video

_No response_

### Logs

<details open><summary>Doctor output channel master</summary>

```console
 Flutter (Channel master, 3.23.0-13.0.pre.79, on macOS 13.6.6 22G630 darwin-arm64, locale pl-PL)
    • Flutter version 3.23.0-13.0.pre.79 on channel master at /Users/arkadiuszkoziol/git/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 691a18df5f (55 minutes ago), 2024-06-03 12:12:11 -0700
    • Engine revision ea72558be7
    • Dart version 3.5.0 (build 3.5.0-214.0.dev)
    • DevTools version 2.36.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/arkadiuszkoziol/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.15.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser)
    ! /Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser is not executable.

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] Connected device (3 available)
    • iPhone (arek) (mobile)          • 130b7ef6202e72e09d74b84afd1a1cd5f82d57dc • ios          • iOS 16.7.7 20H330
    • macOS (desktop)                 • macos                                    • darwin-arm64 • macOS 13.6.6 22G630 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                    • darwin       • macOS 13.6.6 22G630 darwin-arm64

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
```

</details>

### Flutter Doctor output

<details open><summary>Doctor output channel stable</summary>

```console
Flutter (Channel stable, 3.22.1, on Arch Linux 6.9.2-arch1-1, locale pl_PL.UTF-8)
    • Flutter version 3.22.1 on channel stable at /opt/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a14f74ff3a (12 dni temu), 2024-05-22 11:08:21 -0500
    • Engine revision 55eae6864b
    • Dart version 3.4.1
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /opt/android-sdk
    • Platform android-VanillaIceCream, build-tools 34.0.0
    • ANDROID_HOME = /opt/android-sdk
    • ANDROID_SDK_ROOT = /opt/android-sdk
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+9)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /opt/brave-bin/brave

[✓] Linux toolchain - develop for Linux desktop
    • clang version 17.0.6
    • cmake version 3.29.3
    • ninja version 1.12.1
    • pkg-config version 2.1.1

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (3 available)
    • SM S901B (mobile) • R3CT40BG5XE • android-arm64  • Android 14 (API 34)
    • Linux (desktop)   • linux       • linux-x64      • Arch Linux 6.9.2-arch1-1
    • Chrome (web)      • chrome      • web-javascript • Brave Browser 125.1.66.115 unknown

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
```

</details>