Skip to content

An option in yaml configs to make properties "final" and achieve nested access #85

@saeedtaha96

Description

@saeedtaha96

Instead of having:

static const String cat = 'assets/images/cat.png';
static const String ah = 'assets/audio/ah.wav';

I like to have:

final String cat = 'assets/images/cat.png';
final String meow= 'assets/audio/meow.wav';

So I can achieve nested access to all assets by one root class, like:

Assets.images.cat;
Assets.audios.meow;

you can also generate this class

class Assets {
  const Assets._();
  static _AssetImages get images => _AssetImages();
  static _AssetAudios get audios => _AssetAudios();
  static _AssetVideos get videos => _AssetVideos();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions