flutter-forms — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited flutter-forms (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Implement forms using a Form widget to group and validate multiple input fields together.
Form inside a StatefulWidget.GlobalKey<FormState> exactly once as a final variable within the State class.Do not generate a new GlobalKey inside the build method; doing so is resource-expensive and destroys the form's state on every rebuild.
GlobalKey<FormState> to the key property of the Form widget. This uniquely identifies theform and provides access to the FormState for validation and submission.
Form.of(context) to access the FormState from a descendant widget.
Use TextFormField to render Material Design text inputs with built-in validation support. TextFormField is a convenience widget that automatically wraps a standard TextField inside a FormField.
validator() callback function to each TextFormField.String containing the specific error message. TheForm will automatically rebuild to display this text below the field.
message through AppLocalizations.of(context) so error text is translated. See the flutter-localization skill.
null.Follow this sequential workflow to implement and validate a form. Copy the checklist to track your progress.
Task Progress:
StatefulWidget and its corresponding State class.final _formKey = GlobalKey<FormState>(); in the State class.Form widget in the build method and assign key: _formKey.TextFormField widgets as descendants of the Form.validator function for each TextFormField (return String on error, null on success).ElevatedButton).onPressed callback using_formKey.currentState?.validate() ?? false.
#### Validation Decision Logic
When the user triggers the submit action, execute the following conditional logic:
_formKey.currentState?.validate() ?? false. The force-unwrap ! is banned; the null-aware call with a falsefallback is safe when the form is not yet mounted.
true (Valid): All validators returned null. Proceed with form submission (e.g., save data, make API call) anddisplay a success indicator (e.g., a SnackBar).
false (Invalid): One or more validators returned an error string. The FormState automatically rebuilds the UIto display the error messages.
validate() returns true.
#### Complete Validated Form Implementation
Use the following pattern to implement a robust, validated form.
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class UserRegistrationForm extends StatefulWidget {
const UserRegistrationForm({super.key});
@override
State<UserRegistrationForm> createState() => _UserRegistrationFormState();
}
class _UserRegistrationFormState extends State<UserRegistrationForm> {
// 1. Persist the GlobalKey in the State class
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
// 2. Bind the key to the Form
return Form(
key: _formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 3. Add TextFormFields with validators
TextFormField(
decoration: const InputDecoration(
labelText: 'Username',
hintText: 'Enter your username',
),
validator: (value) {
final l10n = AppLocalizations.of(context)!;
if (value == null || value.isEmpty) {
return l10n.usernameRequired; // Error state (localized)
}
if (value.length < 4) {
return l10n.usernameTooShort; // Error state (localized)
}
return null; // Valid state
},
),
const SizedBox(height: 16),
// 4. Add the submit button
ElevatedButton(
onPressed: () {
// 5. Trigger validation logic (no force-unwrap)
if (_formKey.currentState?.validate() ?? false) {
// Form is valid: Process data
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(AppLocalizations.of(context)!.processingData)),
);
} else {
// Form is invalid: Errors are automatically displayed
debugPrint('Form validation failed.');
}
},
child: const Text('Submit'),
),
],
),
);
}
}#### Widget Test Pointer
Cover both branches of the validation gate. Pump the form inside a MaterialApp with AppLocalizations.delegate wired up, then assert the valid-submit and invalid-submit paths:
SnackBar text appears(find.text) and no validator error is shown.
appears and the success SnackBar does not.
See the flutter-testing-apps skill for the Given/When/Then structure and the pumpAndSettle pattern.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.