Resources directory is used to store all the files related to assets.

Let's say we want to use same delete icon from assets in 4 different places, so either we could use asstes/icons/essentials/delete.svg in all the 4 files saparatly or we can assign this path string to one variable in one saparate file and can access that variable in every file. Now if we restructure assets or rename the file, we will have to do the changes in one file only.

As of now we have assets.dart file in Resource directory

class ImageAssets {
  const ImageAssets._();

  // General
  static const iconGeneralBack = 'assets/icons/general/back.svg';
  static const iconGeneralIconClose = 'assets/icons/general/icon_close.svg';
  static const iconGeneralError = 'assets/icons/general/icon_error.svg';
  static const iconGeneralExpand = 'assets/icons/general/icon_expand.svg';
  static const iconGeneralLocation = 'assets/icons/general/icon_location.svg';
  static const iconGeneralNoConnection = 'assets/icons/general/icon_no_connection.svg';
  static const iconGeneralRight = 'assets/icons/general/icon_right.svg';
  static const iconGeneralRadioNormal = 'assets/icons/general/icon_radio_normal.svg';
  static const iconGeneralRadioSelected = 'assets/icons/general/icon_radio_selected.svg';
  static const iconGeneralDelete = 'assets/icons/general/delete.svg';
  static const iconGeneralVideo = 'assets/icons/general/video.svg';
  static const iconGeneralVideoPlayIcon = 'assets/icons/general/icon_play_video.svg';

Developers can add simmilar files like this if needed (e.g. project_assets.dart for storing all project specific assets).

Copyright © 2024