I’m new in flutter and programming, so do not e too harsh please. My downside is following:
I wish to create a customized button for my menu entries and as an alternative of classical textual content parameter, I wish to parse an arb-key (or fairly getter), so the AppLocalizations appears to be like up for the important thing and returns corresponding getter in right language.
import 'bundle:flutter/materials.dart';
import 'bundle:getwidget/getwidget.dart';
import 'bundle:flutter_gen/gen_l10n/app_localizations.dart';
class ExtendableMenuNavigationEntry extends StatelessWidget {
last Widget baby;
last Perform() callback;
last Perform() arbGetter;
const ExtendableMenuNavigationEntry({
tremendous.key,
required this.baby,
required this.callback,
required this.arbKey,
});
@override
Widget construct(BuildContext context) {
return GFButton(
onPressed: () => callback,
textual content: AppLocalizations.of(context)!.arbGetter,
form: GFButtonShape.tablets,
fullWidthButton: true,
);
}
}
Nonetheless, I obtain an error:
The getter 'arbGetter' is not outlined for the kind 'AppLocalizations'.
Attempt importing the library that defines 'arbGetter', correcting the identify to the identify of an current getter, or defining a getter or discipline named 'arbKey'
AppLocalisation is autogenerated, I adopted this information: https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization
Due to my inexperience, I’m not even certain how I ought to name my downside. I do know you should utilize placeholders for vars in Strings, however I do not know tips on how to do it for Features…