Для новых классов стилей Python использует специальный метод поиска, который обходит экземпляры. Здесь выдержка из источника :
1164 /* Internal routines to do a method lookup in the type
1165 without looking in the instance dictionary
1166 (so we can't use PyObject_GetAttr) but still binding
1167 it to the instance. The arguments are the object,
1168 the method name as a C string, and the address of a
1169 static variable used to cache the interned Python string.
1170
1171 Two variants:
1172
1173 - lookup_maybe() returns NULL without raising an exception
1174 when the _PyType_Lookup() call fails;
1175
1176 - lookup_method() always raises an exception upon errors.
1177
1178 - _PyObject_LookupSpecial() exported for the benefit of other places.
1179 */
Вы можете либо перейти к классу старого стиля (не наследовать от объекта ), либо вы можете добавить методы диспетчера к классу (методы, которые перенаправляют поиск обратно в экземпляр). Пример примера методов диспетчера см. В рецепте в http://code.activestate.com/recipes/578091
Просто Добавляют obscureText: верный в TextFormField...
TextFormField(
obscureText: true,
decoration: const InputDecoration(
labelText: 'Password',
),
validator: (String value) {
if (value.trim().isEmpty) {
return 'Password is required';
}
},
),