Dart - How to define an interface like in TypeScript?
To pass the BaseLocale all of your values you could implement it as follows:
class BaseLoginActionsLocale { final String submit; final String forgot; BaseLoginActionsLocale(this.submit, this.forgot);}class BaseLoginLocale { final String title; final BaseLoginActionsLocale actions; BaseLoginLocale(this.title, submit, forgot) : actions = new BaseLoginActionsLocale(submit, forgot);}class BaseLocale { final BaseLoginLocale login; BaseLocale(title, submit, forgot) : login = new BaseLoginLocale(title, submit, forgot); }final BaseLocale enLocale = BaseLocale('Login', 'Login', 'Forgot Password?');
Note that this approach makes it the responsibility of BaseLocale
to know the properties of its dependencies (and by extension the implementation) and may be considered as an anti-pattern by some...