is possible have a configuration file in DART?

Viewed 3339

I have this JavaScript class:

'use strict;'
/* global conf */

var properties = {
    'PROPERTIES': {
        'CHANNEL': 'sport',
        'VIEW_ELEMENTS': {
            'LOADER_CLASS': '.loader',
            'SPLASH_CLASS': '.splash'
        }
    }
};

In JavaScript I can use these properties: properties.PROPERTIES.CHANNEL

Is it possible to convert this to DART? Is there a best practise to do that?

2 Answers

Following up on the above answer using classes, it may be convenient to implement static variables, the downside is that it still must be compiled/rebuilt.

class CONFIG {
  static final String BUILD = "Release";
  static final String DEPLOYMENT = "None";
}

This can be used from a separate class after importing via:

var xyz = CONFIG.BUILD;
Related