Enable use_super_parameters lint rule.

This commit is contained in:
Dain Nilsson 2022-05-12 09:56:55 +02:00
parent 123c1787a6
commit af92068a75
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8
48 changed files with 75 additions and 100 deletions

View File

@ -25,6 +25,7 @@ linter:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
unawaited_futures: true # Explicitly mark futures which are not being awaited
use_super_parameters: true
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View File

@ -16,7 +16,7 @@ import 'widgets/responsive_dialog.dart';
final _log = Logger('about');
class AboutPage extends ConsumerWidget {
const AboutPage({Key? key}) : super(key: key);
const AboutPage({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -60,7 +60,7 @@ class AboutPage extends ConsumerWidget {
}
class LoggingPanel extends ConsumerWidget {
const LoggingPanel({Key? key}) : super(key: key);
const LoggingPanel({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {

View File

@ -18,7 +18,7 @@ final androidYubikeyProvider =
class _YubikeyProvider extends StateNotifier<YubiKeyData?> {
final Ref _ref;
_YubikeyProvider(YubiKeyData? yubiKeyData, this._ref) : super(yubiKeyData);
_YubikeyProvider(super.yubiKeyData, this._ref);
void setFromString(String input) {
try {

View File

@ -10,7 +10,7 @@ final androidStateProvider =
});
class _StateProvider extends StateNotifier<OathState?> {
_StateProvider(OathState? oathState) : super(oathState);
_StateProvider(super.oathState);
void setFromString(String input) {
var resultJson = jsonDecode(input);
@ -24,7 +24,7 @@ final androidCredentialsProvider =
});
class _CredentialsProvider extends StateNotifier<List<OathPair>?> {
_CredentialsProvider(List<OathPair>? credentials) : super(credentials);
_CredentialsProvider(super.credentials);
void setFromString(String input) {
var result = jsonDecode(input);

View File

@ -32,10 +32,9 @@ class _MobileScannerWrapper extends StatelessWidget {
final _ScanStatus status;
const _MobileScannerWrapper({
Key? key,
required this.onDetect,
required this.status,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {
@ -90,7 +89,7 @@ class _MobileScannerWrapper extends StatelessWidget {
}
class QrScannerView extends StatefulWidget {
const QrScannerView({Key? key}) : super(key: key);
const QrScannerView({super.key});
@override
State<QrScannerView> createState() => _QrScannerViewState();

View File

@ -17,8 +17,7 @@ final androidSubPageProvider =
class _AndroidSubPageNotifier extends CurrentAppNotifier {
final AppApi _api = AppApi();
_AndroidSubPageNotifier(List<Application> supportedApps)
: super(supportedApps) {
_AndroidSubPageNotifier(super.supportedApps) {
_handleSubPage(state);
}
@ -43,7 +42,7 @@ final androidAttachedDevicesProvider =
});
class _AndroidAttachedDevicesNotifier extends AttachedDevicesNotifier {
_AndroidAttachedDevicesNotifier(List<DeviceNode> state) : super(state);
_AndroidAttachedDevicesNotifier(super.state);
}
final androidDeviceDataProvider =

View File

@ -7,8 +7,7 @@ import 'state.dart';
class YubicoAuthenticatorApp extends ConsumerWidget {
final Widget page;
const YubicoAuthenticatorApp({required this.page, Key? key})
: super(key: key);
const YubicoAuthenticatorApp({required this.page, super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {

View File

@ -68,7 +68,7 @@ class LogLevelNotifier extends StateNotifier<Level> {
class LogWarningOverlay extends StatelessWidget {
final Widget child;
const LogWarningOverlay({Key? key, required this.child}) : super(key: key);
const LogWarningOverlay({super.key, required this.child});
@override
Widget build(BuildContext context) {

View File

@ -53,7 +53,7 @@ final attachedDevicesProvider =
);
class AttachedDevicesNotifier extends StateNotifier<List<DeviceNode>> {
AttachedDevicesNotifier(List<DeviceNode> state) : super(state);
AttachedDevicesNotifier(super.state);
/// Force a refresh of all device data.
void refresh() {}
@ -70,7 +70,7 @@ final currentDeviceProvider =
(ref) => throw UnimplementedError());
abstract class CurrentDeviceNotifier extends StateNotifier<DeviceNode?> {
CurrentDeviceNotifier(DeviceNode? state) : super(state);
CurrentDeviceNotifier(super.state);
setCurrentDevice(DeviceNode device);
}

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
class AppFailureScreen extends StatelessWidget {
final String reason;
const AppFailureScreen(this.reason, {Key? key}) : super(key: key);
const AppFailureScreen(this.reason, {super.key}) : super();
@override
Widget build(BuildContext context) {

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
class AppLoadingScreen extends StatelessWidget {
const AppLoadingScreen({Key? key}) : super(key: key);
const AppLoadingScreen({super.key});
@override
Widget build(BuildContext context) {

View File

@ -11,12 +11,11 @@ class AppPage extends ConsumerWidget {
final Widget? floatingActionButton;
final bool centered;
AppPage(
{Key? key,
{super.key,
this.title,
required this.child,
this.floatingActionButton,
this.centered = false})
: super(key: key);
this.centered = false});
@override
Widget build(BuildContext context, WidgetRef ref) => LayoutBuilder(

View File

@ -8,8 +8,7 @@ class DeviceAvatar extends StatelessWidget {
final Widget child;
final IconData? badge;
const DeviceAvatar(
{Key? key, this.selected = false, required this.child, this.badge})
: super(key: key);
{super.key, this.selected = false, required this.child, this.badge});
factory DeviceAvatar.yubiKeyData(YubiKeyData data, {bool selected = false}) =>
DeviceAvatar(

View File

@ -6,7 +6,7 @@ import 'device_avatar.dart';
import 'device_picker_dialog.dart';
class DeviceButton extends ConsumerWidget {
const DeviceButton({Key? key}) : super(key: key);
const DeviceButton({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {

View File

@ -9,7 +9,7 @@ import '../state.dart';
import 'device_avatar.dart';
class DevicePickerDialog extends ConsumerWidget {
const DevicePickerDialog({Key? key}) : super(key: key);
const DevicePickerDialog({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -68,8 +68,7 @@ class _CurrentDeviceRow extends StatelessWidget {
this.node, {
this.data,
required this.onTap,
Key? key,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {
@ -134,8 +133,7 @@ class _DeviceRow extends StatelessWidget {
this.node, {
required this.info,
required this.onTap,
Key? key,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {

View File

@ -30,7 +30,7 @@ extension on Application {
class MainPageDrawer extends ConsumerWidget {
final bool shouldPop;
const MainPageDrawer({this.shouldPop = true, Key? key}) : super(key: key);
const MainPageDrawer({this.shouldPop = true, super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -134,8 +134,8 @@ class ApplicationItem extends ConsumerWidget {
required this.available,
required this.selected,
required this.onSelect,
Key? key,
}) : super(key: key);
super.key,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -167,8 +167,8 @@ class DrawerItem extends StatelessWidget {
this.onTap,
this.selected = false,
this.enabled = true,
Key? key,
}) : super(key: key);
super.key,
});
@override
Widget build(BuildContext context) {

View File

@ -10,7 +10,7 @@ import '../../oath/views/oath_screen.dart';
import '../../management/views/management_screen.dart';
class MainPage extends ConsumerWidget {
const MainPage({Key? key}) : super(key: key);
const MainPage({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {

View File

@ -9,12 +9,12 @@ class MessagePage extends StatelessWidget {
final Widget? floatingActionButton;
const MessagePage({
Key? key,
super.key,
this.title,
required this.header,
required this.message,
this.floatingActionButton,
}) : super(key: key);
});
@override
Widget build(BuildContext context) => AppPage(

View File

@ -12,7 +12,7 @@ import 'device_avatar.dart';
class NoDeviceScreen extends ConsumerWidget {
final DeviceNode? node;
const NoDeviceScreen(this.node, {Key? key}) : super(key: key);
const NoDeviceScreen(this.node, {super.key});
List<Widget> _buildUsbPid(BuildContext context, WidgetRef ref, UsbPid pid) {
if (pid.usbInterfaces == UsbInterface.fido.value) {

View File

@ -40,8 +40,7 @@ class _UserInteractionController extends UserInteractionController
class _UserInteractionDialog extends StatefulWidget {
final _UserInteractionController controller;
const _UserInteractionDialog({Key? key, required this.controller})
: super(key: key);
const _UserInteractionDialog({required this.controller});
@override
State<_UserInteractionDialog> createState() => _UserInteractionDialogState();

View File

@ -29,7 +29,7 @@ final _oathLockKeyProvider =
(ref, devicePath) => _LockKeyNotifier(null));
class _LockKeyNotifier extends StateNotifier<String?> {
_LockKeyNotifier(String? state) : super(state);
_LockKeyNotifier(super.state);
setKey(String key) {
state = key;

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
class ErrorPage extends StatelessWidget {
final String error;
const ErrorPage({required this.error, Key? key}) : super(key: key);
const ErrorPage({required this.error, super.key});
@override
Widget build(BuildContext context) {

View File

@ -18,7 +18,7 @@ final _log = Logger('fido.views.add_fingerprint_dialog');
class AddFingerprintDialog extends ConsumerStatefulWidget {
final DevicePath devicePath;
const AddFingerprintDialog(this.devicePath, {Key? key}) : super(key: key);
const AddFingerprintDialog(this.devicePath, {super.key});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>

View File

@ -13,8 +13,7 @@ import '../../app/state.dart';
class DeleteCredentialDialog extends ConsumerWidget {
final DevicePath devicePath;
final FidoCredential credential;
const DeleteCredentialDialog(this.devicePath, this.credential, {Key? key})
: super(key: key);
const DeleteCredentialDialog(this.devicePath, this.credential, {super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {

View File

@ -11,8 +11,7 @@ import '../../app/state.dart';
class DeleteFingerprintDialog extends ConsumerWidget {
final DevicePath devicePath;
final Fingerprint fingerprint;
const DeleteFingerprintDialog(this.devicePath, this.fingerprint, {Key? key})
: super(key: key);
const DeleteFingerprintDialog(this.devicePath, this.fingerprint, {super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {

View File

@ -18,7 +18,7 @@ import 'unlocked_page.dart';
class FidoScreen extends ConsumerWidget {
final YubiKeyData deviceData;
const FidoScreen(this.deviceData, {Key? key}) : super(key: key);
const FidoScreen(this.deviceData, {super.key});
@override
Widget build(BuildContext context, WidgetRef ref) =>

View File

@ -14,7 +14,7 @@ class FidoLockedPage extends ConsumerWidget {
final DeviceNode node;
final FidoState state;
const FidoLockedPage(this.node, this.state, {Key? key}) : super(key: key);
const FidoLockedPage(this.node, this.state, {super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -88,8 +88,7 @@ class FidoLockedPage extends ConsumerWidget {
class _PinEntryForm extends ConsumerStatefulWidget {
final FidoState _state;
final DeviceNode _deviceNode;
const _PinEntryForm(this._state, this._deviceNode, {Key? key})
: super(key: key);
const _PinEntryForm(this._state, this._deviceNode);
@override
ConsumerState<_PinEntryForm> createState() => _PinEntryFormState();

View File

@ -11,8 +11,7 @@ import '../state.dart';
class FidoPinDialog extends ConsumerStatefulWidget {
final DevicePath devicePath;
final FidoState state;
const FidoPinDialog(this.devicePath, this.state, {Key? key})
: super(key: key);
const FidoPinDialog(this.devicePath, this.state, {super.key});
@override
ConsumerState<ConsumerStatefulWidget> createState() => _FidoPinDialogState();

View File

@ -11,8 +11,7 @@ import '../../app/state.dart';
class RenameFingerprintDialog extends ConsumerStatefulWidget {
final DevicePath devicePath;
final Fingerprint fingerprint;
const RenameFingerprintDialog(this.devicePath, this.fingerprint, {Key? key})
: super(key: key);
const RenameFingerprintDialog(this.devicePath, this.fingerprint, {super.key});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>

View File

@ -17,7 +17,7 @@ final _log = Logger('fido.views.reset_dialog');
class ResetDialog extends ConsumerStatefulWidget {
final DeviceNode node;
const ResetDialog(this.node, {Key? key}) : super(key: key);
const ResetDialog(this.node, {super.key});
@override
ConsumerState<ConsumerStatefulWidget> createState() => _ResetDialogState();

View File

@ -18,7 +18,7 @@ class FidoUnlockedPage extends ConsumerWidget {
final DeviceNode node;
final FidoState state;
const FidoUnlockedPage(this.node, this.state, {Key? key}) : super(key: key);
const FidoUnlockedPage(this.node, this.state, {super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {

View File

@ -55,7 +55,7 @@ void _initializeDebugLogging() {
//TODO: Remove below this
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});
// This widget is the root of your application.
@override
@ -80,7 +80,7 @@ class MyApp extends StatelessWidget {
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
const MyHomePage({super.key, required this.title});
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect

View File

@ -18,12 +18,11 @@ class _CapabilityForm extends StatelessWidget {
final int capabilities;
final int enabled;
final Function(int) onChanged;
const _CapabilityForm(
{required this.capabilities,
required this.enabled,
required this.onChanged,
Key? key})
: super(key: key);
const _CapabilityForm({
required this.capabilities,
required this.enabled,
required this.onChanged,
});
@override
Widget build(BuildContext context) {
@ -48,8 +47,7 @@ class _CapabilityForm extends StatelessWidget {
class _ModeForm extends StatelessWidget {
final int interfaces;
final Function(int) onChanged;
const _ModeForm(this.interfaces, {required this.onChanged, Key? key})
: super(key: key);
const _ModeForm(this.interfaces, {required this.onChanged});
@override
Widget build(BuildContext context) {
@ -77,8 +75,7 @@ class _CapabilitiesForm extends StatelessWidget {
required this.onChanged,
required this.supported,
required this.enabled,
Key? key,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {
@ -119,7 +116,7 @@ class _CapabilitiesForm extends StatelessWidget {
class ManagementScreen extends ConsumerStatefulWidget {
final YubiKeyData deviceData;
const ManagementScreen(this.deviceData, {Key? key}) : super(key: key);
const ManagementScreen(this.deviceData, {super.key});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>

View File

@ -12,7 +12,7 @@ import 'account_mixin.dart';
class AccountDialog extends ConsumerWidget with AccountMixin {
@override
final OathCredential credential;
const AccountDialog(this.credential, {Key? key}) : super(key: key);
const AccountDialog(this.credential, {super.key});
@override
Future<OathCredential?> renameCredential(

View File

@ -10,8 +10,7 @@ import 'account_view.dart';
class AccountList extends ConsumerStatefulWidget {
final DevicePath devicePath;
final OathState oathState;
const AccountList(this.devicePath, this.oathState, {Key? key})
: super(key: key);
const AccountList(this.devicePath, this.oathState, {super.key});
@override
ConsumerState<AccountList> createState() => _AccountListState();

View File

@ -13,7 +13,7 @@ class AccountView extends ConsumerWidget with AccountMixin {
@override
final OathCredential credential;
final FocusNode? focusNode;
AccountView(this.credential, {Key? key, this.focusNode}) : super(key: key);
AccountView(this.credential, {super.key, this.focusNode});
Color _iconColor(int shade) {
final colors = [

View File

@ -27,8 +27,7 @@ class OathAddAccountPage extends ConsumerStatefulWidget {
final DevicePath devicePath;
final bool openQrScanner;
const OathAddAccountPage(this.devicePath,
{Key? key, required this.openQrScanner})
: super(key: key);
{super.key, required this.openQrScanner});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>

View File

@ -11,8 +11,7 @@ import '../../app/state.dart';
class DeleteAccountDialog extends ConsumerWidget {
final DeviceNode device;
final OathCredential credential;
const DeleteAccountDialog(this.device, this.credential, {Key? key})
: super(key: key);
const DeleteAccountDialog(this.device, this.credential, {super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {

View File

@ -11,8 +11,7 @@ import '../state.dart';
class ManagePasswordDialog extends ConsumerStatefulWidget {
final DevicePath path;
final OathState state;
const ManagePasswordDialog(this.path, this.state, {Key? key})
: super(key: key);
const ManagePasswordDialog(this.path, this.state, {super.key});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>

View File

@ -19,7 +19,7 @@ import 'reset_dialog.dart';
class OathScreen extends ConsumerWidget {
final DevicePath devicePath;
const OathScreen(this.devicePath, {Key? key}) : super(key: key);
const OathScreen(this.devicePath, {super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -45,8 +45,7 @@ class _LockedView extends ConsumerWidget {
final DevicePath devicePath;
final OathState oathState;
const _LockedView(this.devicePath, this.oathState, {Key? key})
: super(key: key);
const _LockedView(this.devicePath, this.oathState);
@override
Widget build(BuildContext context, WidgetRef ref) => AppPage(
@ -68,8 +67,7 @@ class _UnlockedView extends ConsumerWidget {
final DevicePath devicePath;
final OathState oathState;
const _UnlockedView(this.devicePath, this.oathState, {Key? key})
: super(key: key);
const _UnlockedView(this.devicePath, this.oathState);
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -169,8 +167,7 @@ class _UnlockForm extends ConsumerStatefulWidget {
final OathState _oathState;
final KeystoreState keystore;
const _UnlockForm(this._devicePath, this._oathState,
{Key? key, required this.keystore})
: super(key: key);
{required this.keystore});
@override
ConsumerState<_UnlockForm> createState() => _UnlockFormState();

View File

@ -12,8 +12,7 @@ import 'utils.dart';
class RenameAccountDialog extends ConsumerStatefulWidget {
final DeviceNode device;
final OathCredential credential;
const RenameAccountDialog(this.device, this.credential, {Key? key})
: super(key: key);
const RenameAccountDialog(this.device, this.credential, {super.key});
@override
ConsumerState<ConsumerStatefulWidget> createState() =>

View File

@ -9,7 +9,7 @@ import '../../app/state.dart';
class ResetDialog extends ConsumerWidget {
final DevicePath devicePath;
const ResetDialog(this.devicePath, {Key? key}) : super(key: key);
const ResetDialog(this.devicePath, {super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {

View File

@ -9,7 +9,7 @@ import 'widgets/responsive_dialog.dart';
final _log = Logger('settings');
class SettingsPage extends ConsumerWidget {
const SettingsPage({Key? key}) : super(key: key);
const SettingsPage({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {

View File

@ -5,8 +5,7 @@ import 'progress_circle.dart';
class CircleTimer extends StatefulWidget {
final int validFromMs;
final int validToMs;
const CircleTimer(this.validFromMs, this.validToMs, {Key? key})
: super(key: key);
const CircleTimer(this.validFromMs, this.validToMs, {super.key});
@override
State<StatefulWidget> createState() => _CircleTimerState();

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
class DialogFrame extends StatelessWidget {
final Widget child;
const DialogFrame({Key? key, required this.child}) : super(key: key);
const DialogFrame({super.key, required this.child});
@override
Widget build(BuildContext context) => GestureDetector(

View File

@ -7,11 +7,11 @@ class FileDropTarget extends StatefulWidget {
final Widget? overlay;
const FileDropTarget({
Key? key,
super.key,
required this.child,
required this.onFileDropped,
this.overlay,
}) : super(key: key);
});
@override
State<StatefulWidget> createState() => _FileDropTargetState();

View File

@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
class ProgressCircle extends StatelessWidget {
final Color color;
final double progress;
const ProgressCircle(this.color, this.progress, {Key? key}) : super(key: key);
const ProgressCircle(this.color, this.progress, {super.key});
@override
Widget build(BuildContext context) {

View File

@ -9,12 +9,11 @@ class ResponsiveDialog extends StatefulWidget {
final Function()? onCancel;
const ResponsiveDialog(
{Key? key,
{super.key,
required this.child,
this.title,
this.actions = const [],
this.onCancel})
: super(key: key);
this.onCancel});
@override
State<ResponsiveDialog> createState() => _ResponsiveDialogState();