//access to a Constant if it was like another language
ImageWeather.Desktop.cloud;
//What i wanted ( not working because there is no inner class)
class ImageWeather {
class Desktop {
static const String cloud = 'assets/images/DesktopCloud.png';
static const String noCloud = 'assets/images/DesktopNoCloud.png';
static const String rain = 'assets/images/DesktopRain.png';
}
class Phone{
static const String cloud = 'assets/images/PhoneCloud.png';
static const String noCloud = 'assets/images/PhoneNoCloud.png';
static const String rain = 'assets/images/PhoneRain.png';
}
}
//access to a String like an inner class with new code
ImageWeather.desktop.cloud;
class ImageWeather {
static final Desktop desktop = Desktop();
static final Phone phone = Phone();
}
class Desktop {
get cloud => 'assets/images/DesktopCloud.png';
get noCloud => 'assets/images/DesktopNoCloud.png';
get rain => 'assets/images/DesktopRain.png';
}
class Phone {
get cloud => 'assets/images/PhoneCloud.png';
get noCloud => 'assets/images/PhoneNoCloud.png';
get rain => 'assets/images/PhoneRain.png';
}
I'm currently learning Dart and I just see that I can't use an inner class. Is there a way to write something similar to inner classes in Dart?