While applying the localisations I also realised the following in the source code :
We should use global constants instead of duplicated hardcoded values (i.e min the length for password, for account name, vault extension file..)
Don’t know how it works in flutter, but I guess inheritance for custom widgets is possible and we should uses more this instead of duplicating code (i.e password creation, they are like 3 views that contains duplicated code)
Please let’s use more utility files instead of code duplication
They are many warnings in the source code. I saw many related to unused imports, unused variables, wrong use of BuildContext (which I also introduce had to introduce for the localisation) transferring between methods as parameters), recommendation to define some objects as Const to improve performance, some unnecessary container objects added in the widgets, Unnecessary braces in a string interpolation, among others. We should remove this as might lead to issues in the future.
I saw Exception objects contain only message (string value). Can we use numeric error codes as well? I didn't apply localisations for most of them because I don't know if this will break some condition in the code and I guess most of them are just directly as error message to the user, so always in English. I saw some external libraries used are also throwing the exceptions like this, which seems weird to me honestly. i.e
We can also use numeric (or string token constant) values for exceptions. Generally people use plain strings a lot in flutter but I agree it's an anti-pattern
Buildcontext tranferred as async parameter is no problem provided that you check that it has been mounted (context.mounted) first. We can turn this warning off altogether. I was planning to do some bookkeeping by removing unused imports but need to perform some extra testing because some imports from intl convert etc are falsely detected as unused by dart.
Normally you favor polymorphism via config vs inheritance in dart. I need to move some "page" components to stateful components and replace copied code
While applying the localisations I also realised the following in the source code :