[local_auth] Switch to new analysis options (#4604)

Removes the legacy analysis options and fixes all violations. Most fixes were automated `dart fix --apply` changes.

Part of https://github.com/flutter/flutter/issues/76229
diff --git a/packages/local_auth/CHANGELOG.md b/packages/local_auth/CHANGELOG.md
index 82358d6..7fe3a98 100644
--- a/packages/local_auth/CHANGELOG.md
+++ b/packages/local_auth/CHANGELOG.md
@@ -1,5 +1,6 @@
-## NEXT
+## 1.1.9
 
+* Updates code for analysis option changes.
 * Updates Android compileSdkVersion to 31.
 
 ## 1.1.8
diff --git a/packages/local_auth/analysis_options.yaml b/packages/local_auth/analysis_options.yaml
deleted file mode 100644
index cda4f6e..0000000
--- a/packages/local_auth/analysis_options.yaml
+++ /dev/null
@@ -1 +0,0 @@
-include: ../../analysis_options_legacy.yaml
diff --git a/packages/local_auth/example/lib/main.dart b/packages/local_auth/example/lib/main.dart
index b6b6f32..a9604b3 100644
--- a/packages/local_auth/example/lib/main.dart
+++ b/packages/local_auth/example/lib/main.dart
@@ -31,7 +31,7 @@
   void initState() {
     super.initState();
     auth.isDeviceSupported().then(
-          (isSupported) => setState(() => _supportState = isSupported
+          (bool isSupported) => setState(() => _supportState = isSupported
               ? _SupportState.supported
               : _SupportState.unsupported),
         );
@@ -45,7 +45,9 @@
       canCheckBiometrics = false;
       print(e);
     }
-    if (!mounted) return;
+    if (!mounted) {
+      return;
+    }
 
     setState(() {
       _canCheckBiometrics = canCheckBiometrics;
@@ -60,7 +62,9 @@
       availableBiometrics = <BiometricType>[];
       print(e);
     }
-    if (!mounted) return;
+    if (!mounted) {
+      return;
+    }
 
     setState(() {
       _availableBiometrics = availableBiometrics;
@@ -85,11 +89,13 @@
       print(e);
       setState(() {
         _isAuthenticating = false;
-        _authorized = "Error - ${e.message}";
+        _authorized = 'Error - ${e.message}';
       });
       return;
     }
-    if (!mounted) return;
+    if (!mounted) {
+      return;
+    }
 
     setState(
         () => _authorized = authenticated ? 'Authorized' : 'Not Authorized');
@@ -116,11 +122,13 @@
       print(e);
       setState(() {
         _isAuthenticating = false;
-        _authorized = "Error - ${e.message}";
+        _authorized = 'Error - ${e.message}';
       });
       return;
     }
-    if (!mounted) return;
+    if (!mounted) {
+      return;
+    }
 
     final String message = authenticated ? 'Authorized' : 'Not Authorized';
     setState(() {
@@ -128,7 +136,7 @@
     });
   }
 
-  void _cancelAuthentication() async {
+  Future<void> _cancelAuthentication() async {
     await auth.stopAuthentication();
     setState(() => _isAuthenticating = false);
   }
@@ -142,67 +150,68 @@
         ),
         body: ListView(
           padding: const EdgeInsets.only(top: 30),
-          children: [
+          children: <Widget>[
             Column(
               mainAxisAlignment: MainAxisAlignment.center,
-              children: [
+              children: <Widget>[
                 if (_supportState == _SupportState.unknown)
-                  CircularProgressIndicator()
+                  const CircularProgressIndicator()
                 else if (_supportState == _SupportState.supported)
-                  Text("This device is supported")
+                  const Text('This device is supported')
                 else
-                  Text("This device is not supported"),
-                Divider(height: 100),
+                  const Text('This device is not supported'),
+                const Divider(height: 100),
                 Text('Can check biometrics: $_canCheckBiometrics\n'),
                 ElevatedButton(
                   child: const Text('Check biometrics'),
                   onPressed: _checkBiometrics,
                 ),
-                Divider(height: 100),
+                const Divider(height: 100),
                 Text('Available biometrics: $_availableBiometrics\n'),
                 ElevatedButton(
                   child: const Text('Get available biometrics'),
                   onPressed: _getAvailableBiometrics,
                 ),
-                Divider(height: 100),
+                const Divider(height: 100),
                 Text('Current State: $_authorized\n'),
-                (_isAuthenticating)
-                    ? ElevatedButton(
-                        onPressed: _cancelAuthentication,
+                if (_isAuthenticating)
+                  ElevatedButton(
+                    onPressed: _cancelAuthentication,
+                    child: Row(
+                      mainAxisSize: MainAxisSize.min,
+                      children: const <Widget>[
+                        Text('Cancel Authentication'),
+                        Icon(Icons.cancel),
+                      ],
+                    ),
+                  )
+                else
+                  Column(
+                    children: <Widget>[
+                      ElevatedButton(
                         child: Row(
                           mainAxisSize: MainAxisSize.min,
-                          children: [
-                            Text("Cancel Authentication"),
-                            Icon(Icons.cancel),
+                          children: const <Widget>[
+                            Text('Authenticate'),
+                            Icon(Icons.perm_device_information),
                           ],
                         ),
-                      )
-                    : Column(
-                        children: [
-                          ElevatedButton(
-                            child: Row(
-                              mainAxisSize: MainAxisSize.min,
-                              children: [
-                                Text('Authenticate'),
-                                Icon(Icons.perm_device_information),
-                              ],
-                            ),
-                            onPressed: _authenticate,
-                          ),
-                          ElevatedButton(
-                            child: Row(
-                              mainAxisSize: MainAxisSize.min,
-                              children: [
-                                Text(_isAuthenticating
-                                    ? 'Cancel'
-                                    : 'Authenticate: biometrics only'),
-                                Icon(Icons.fingerprint),
-                              ],
-                            ),
-                            onPressed: _authenticateWithBiometrics,
-                          ),
-                        ],
+                        onPressed: _authenticate,
                       ),
+                      ElevatedButton(
+                        child: Row(
+                          mainAxisSize: MainAxisSize.min,
+                          children: <Widget>[
+                            Text(_isAuthenticating
+                                ? 'Cancel'
+                                : 'Authenticate: biometrics only'),
+                            const Icon(Icons.fingerprint),
+                          ],
+                        ),
+                        onPressed: _authenticateWithBiometrics,
+                      ),
+                    ],
+                  ),
               ],
             ),
           ],
diff --git a/packages/local_auth/example/pubspec.yaml b/packages/local_auth/example/pubspec.yaml
index 3aa8fd8..ad0de20 100644
--- a/packages/local_auth/example/pubspec.yaml
+++ b/packages/local_auth/example/pubspec.yaml
@@ -18,10 +18,10 @@
     path: ../
 
 dev_dependencies:
-  integration_test:
-    sdk: flutter
   flutter_driver:
     sdk: flutter
+  integration_test:
+    sdk: flutter
   pedantic: ^1.10.0
 
 flutter:
diff --git a/packages/local_auth/lib/local_auth.dart b/packages/local_auth/lib/local_auth.dart
index 0b75a83..af02d57 100644
--- a/packages/local_auth/lib/local_auth.dart
+++ b/packages/local_auth/lib/local_auth.dart
@@ -32,7 +32,7 @@
 class LocalAuthentication {
   /// The `authenticateWithBiometrics` method has been deprecated.
   /// Use `authenticate` with `biometricOnly: true` instead
-  @Deprecated("Use `authenticate` with `biometricOnly: true` instead")
+  @Deprecated('Use `authenticate` with `biometricOnly: true` instead')
   Future<bool> authenticateWithBiometrics({
     required String localizedReason,
     bool useErrorDialogs = true,
@@ -160,9 +160,9 @@
     final List<String> result = (await _channel.invokeListMethod<String>(
           'getAvailableBiometrics',
         )) ??
-        [];
+        <String>[];
     final List<BiometricType> biometrics = <BiometricType>[];
-    result.forEach((String value) {
+    for (final String value in result) {
       switch (value) {
         case 'face':
           biometrics.add(BiometricType.face);
@@ -176,7 +176,7 @@
         case 'undefined':
           break;
       }
-    });
+    }
     return biometrics;
   }
 }
diff --git a/packages/local_auth/pubspec.yaml b/packages/local_auth/pubspec.yaml
index 4f5ef26..9303b0c 100644
--- a/packages/local_auth/pubspec.yaml
+++ b/packages/local_auth/pubspec.yaml
@@ -3,7 +3,7 @@
   authentication via fingerprint, touch ID, face ID, passcode, pin, or pattern.
 repository: https://github.com/flutter/plugins/tree/master/packages/local_auth
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+local_auth%22
-version: 1.1.8
+version: 1.1.9
 
 environment:
   sdk: ">=2.14.0 <3.0.0"
diff --git a/packages/local_auth/test/local_auth_test.dart b/packages/local_auth/test/local_auth_test.dart
index b24de8b..758b9ce 100644
--- a/packages/local_auth/test/local_auth_test.dart
+++ b/packages/local_auth/test/local_auth_test.dart
@@ -30,7 +30,7 @@
       log.clear();
     });
 
-    group("With device auth fail over", () {
+    group('With device auth fail over', () {
       test('authenticate with no args on Android.', () async {
         setMockPathProviderPlatform(FakePlatform(operatingSystem: 'android'));
         await localAuthentication.authenticate(
@@ -108,7 +108,7 @@
       });
     });
 
-    group("With biometrics only", () {
+    group('With biometrics only', () {
       test('authenticate with no args on Android.', () async {
         setMockPathProviderPlatform(FakePlatform(operatingSystem: 'android'));
         await localAuthentication.authenticate(
diff --git a/script/configs/custom_analysis.yaml b/script/configs/custom_analysis.yaml
index e991e5e..71ce141 100644
--- a/script/configs/custom_analysis.yaml
+++ b/script/configs/custom_analysis.yaml
@@ -27,7 +27,6 @@
 - in_app_purchase/in_app_purchase_android
 - in_app_purchase/in_app_purchase_storekit
 - ios_platform_images
-- local_auth
 - video_player/video_player
 - video_player/video_player_platform_interface
 - video_player/video_player_web