Repository: flutter
Issue: [Android]TextInputClient doesn't accept first character input as number
Labels: a: text input,platform-android,framework,has reproducible steps,P2,found in release: 2.10,found in release: 2.11,team-text-input,triaged-text-input

## Abstract
`TextInputClient.updateEditingValue(value)` didn't catch first system keyboard character input, if:
1. To `TextInput.attach(client, config)` was given config with the `inputType` as `TextInputType.phone`, `TextInputType.number` or `TextInputType.numberWithOptions()`.
2. The first input after keyboard appearance is a number.

## Steps to Reproduce

1. Execute `flutter run` on the code sample
2. Tap on the blue container and ensure that with `TextInputType.text` first character input as number is received (it should appear below blue container and it should be printed in console via `print()`)
3. In method `_handleInputConnection` change `inputType` from `TextInputType.text` to any of 3 commented variants (`TextInputType.phone`, `TextInputType.number` or `TextInputType.numberWithOptions()`)
4. Close keyboard, then restart or hot restart the app
5. Tap on the blue container and then press on any number button on system keyboard

**Expected results:**
After step 5 the first character as number should also appear below the blue container and console shold print this character

**Actual results:** 
After step 5 nothing will appear below container and nothing will be printed in console. Numbers will appear only after any non-number input as first character.

**Tested on devices**
Android emulator API 29 
Android real device API 30

<details>
<summary>flutter doctor -v</summary>

```
[√] Flutter (Channel stable, 2.10.0, on Microsoft Windows [Version 10.0.19044.1526], locale ru-RU)
    • Flutter version 2.10.0 at O:\SDKs\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5f105a6ca7 (12 days ago), 2022-02-01 14:15:42 -0800
    • Engine revision 776efd2034
    • Dart version 2.16.0
    • DevTools version 2.9.2

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at O:\SDKs\Android
    • Platform android-31, build-tools 31.0.0
    • ANDROID_HOME = O:\SDKs\Android
    • Java binary at: O:\Programs\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    • All Android licenses accepted.

[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2021.1)
    • Android Studio at O:\Programs\Android Studio
    • 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 11.0.11+9-b60-7590822)

[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    X Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know
      about this issue at https://github.com/flutter/flutter/issues.
    X FormatException: Unexpected extension byte (at offset 5)
    • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
      #1      Utf8Decoder.convert (dart:convert/utf.dart:351:42)
      #2      InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
      #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
      #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
      #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
      #6      IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
      #7      IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
      #8      IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
      #9      IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
      #10     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
      #11     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
      #12     _rootRun (dart:async/zone.dart:1426:13)
      #13     _CustomZone.run (dart:async/zone.dart:1328:19)
      #14     _runZoned (dart:async/zone.dart:1861:10)
      #15     runZonedGuarded (dart:async/zone.dart:1849:12)
      #16     runZoned (dart:async/zone.dart:1780:12)
      #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
      #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:205:9)
      #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:309:47)
      #20     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:50:48)
      #21     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1320:12)
      <asynchronous suspension>
      #22     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
      <asynchronous suspension>
      #25     FlutterCommandRunner.runCommand.<anonymous closure>
      (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
      <asynchronous suspension>
      #26     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
      <asynchronous suspension>
      #28     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
      <asynchronous suspension>
      #29     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #30     main (package:flutter_tools/executable.dart:94:3)
      <asynchronous suspension>


[√] Connected device (3 available)
    • NTH NX9 (mobile)  • A7QXVB1A05010398 • android-arm64  • Android 11 (API 30)
    • Windows (desktop) • windows          • windows-x64    • Microsoft Windows [Version 10.0.19044.1526]
    • Edge (web)        • edge             • web-javascript • Microsoft Edge 98.0.1108.43

[√] HTTP Host Availability
    • All required HTTP hosts are available
```

</details>


<details>
<summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Sample Input Client',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const HomeScreen(),
    );
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: SafeArea(
        child: Center(
          child: Padding(
            padding: EdgeInsets.symmetric(horizontal: 16.0),
            child: SampleInputField(),
          ),
        ),
      ),
    );
  }
}

class SampleInputField extends StatefulWidget {
  const SampleInputField({
    Key? key,
  }) : super(key: key);

  @override
  State<SampleInputField> createState() => _SampleInputFieldState();
}

class _SampleInputFieldState extends State<SampleInputField>
    implements TextInputClient {
  late final TextEditingController _textEditingController;
  TextInputConnection? _textInputConnection;

  @override
  void initState() {
    super.initState();

    _textEditingController = TextEditingController();
  }

  @override
  void dispose() {
    _textEditingController.dispose();
    _textInputConnection?.close();

    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        GestureDetector(
          onTap: () {
            _handleInputConnection();
          },
          child: Container(
            height: 100.0,
            color: Colors.blue,
            child: const Center(
              child: Text('TAP ME'),
            ),
          ),
        ),
        ValueListenableBuilder<TextEditingValue>(
          valueListenable: _textEditingController,
          builder: (context, value, _) {
            return Text(value.text);
          },
        ),
      ],
    );
  }

  void _handleInputConnection() {
    final connectionIsNotAttached = !(_textInputConnection?.attached ?? false);
    if (connectionIsNotAttached) {
      const config = TextInputConfiguration(
        // this is default value and everything works fine
        inputType: TextInputType.text,
        // with this 3 types input doesn't work properly
        // inputType: TextInputType.phone,
        // inputType: TextInputType.number,
        // inputType: TextInputType.numberWithOptions(),
      );
      _textInputConnection = TextInput.attach(this, config);
    }

    _textInputConnection!
      ..setEditingState(_textEditingController.value)
      ..show();
  }

  @override
  void connectionClosed() {}

  @override
  AutofillScope? get currentAutofillScope => null;

  @override
  TextEditingValue? get currentTextEditingValue => _textEditingController.value;

  @override
  void performAction(TextInputAction action) {
    switch (action) {
      case TextInputAction.done:
        _textInputConnection?.close();
        break;
      case TextInputAction.none:
      case TextInputAction.unspecified:
      case TextInputAction.go:
      case TextInputAction.search:
      case TextInputAction.send:
      case TextInputAction.next:
      case TextInputAction.previous:
      case TextInputAction.continueAction:
      case TextInputAction.join:
      case TextInputAction.route:
      case TextInputAction.emergencyCall:
      case TextInputAction.newline:
        break;
    }
  }

  @override
  void performPrivateCommand(String action, Map<String, dynamic> data) {}

  @override
  void showAutocorrectionPromptRect(int start, int end) {}

  @override
  void updateEditingValue(TextEditingValue value) {
    print('update value ${value.text}');
    _textEditingController.value = value;
  }

  @override
  void updateFloatingCursor(RawFloatingCursorPoint point) {}
}
```

</details>