a class method named ._() function in dart?

AppTheme._(); is a named constructor (another examples might be the copy constructor on some objects in the Flutter framework: ThemeData.copy(...);).

In dart, if the leading character is an underscore, then the function/constructor is private to the library. That’s also the case here, and the underscore is also the only character, so I’d imagine whoever wrote this constructor didn’t plan for that constructor to ever be called at all.

The AppTheme._(); isn’t necessary unless you don’t want AppTheme to ever be accidentally instantiated using the implicit default constructor.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)