web_app_config 2.0.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 66

web_app_config

Tools to configure Dart web apps using environment variables.

Example

The example/ directory contains an example project.

When the server runs, it writes a config.json file based on the desired environment variables:

const List<String> supportedKeys = const <String>[
  'app_name',
  'app_description',
  'app_version',
];

Future main() async {
  await wconfig.writeConfigFromEnvironment(supportedKeys);
  // ...

Then, when the client runs, that configuration can be loaded and parsed into a map:

const List<String> supportedKeys = const <String>[
  'app_name',
  'app_description',
  'app_version',
];

Future main() async {
  await wconfig.writeConfigFromEnvironment(supportedKeys);

When app is run in development mode, (pub serve or webdev serve) the configuration is loaded from web/config.yaml

pub build # Dart 2: webdev build

dart bin/server.dart

# observe the app says "name: my awesome app", configured in config.yaml

# stop server

export APP_NAME="i am configured using an env var"

dart bin/server.dart

# observe the app now says "name: i am configured using an env var" 

# stop server

unset APP_NAME

dart bin/server.dart

# observe the app says "name: my awesome app" again

0.0.1

  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  web_app_config: ^2.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:web_app_config/client.dart';
import 'package:web_app_config/server.dart';
  
Version Uploaded Documentation Archive
2.0.1 Aug 22, 2018 Go to the documentation of web_app_config 2.0.1 Download web_app_config 2.0.1 archive
2.0.0 Aug 18, 2018 Go to the documentation of web_app_config 2.0.0 Download web_app_config 2.0.0 archive
1.0.0 Aug 15, 2018 Go to the documentation of web_app_config 1.0.0 Download web_app_config 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6

Platforms

Detected platforms: Flutter, other

Platform components identified in package: io.

Health suggestions

Format lib/client.dart.

Run dartfmt to format lib/client.dart.

Format lib/server.dart.

Run dartfmt to format lib/server.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
dart2_constant ^1.0.0 1.0.2+dart2
http ^0.11.3 0.11.3+17 0.12.0
yaml ^2.1.13 2.1.15
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.6
path 1.6.2
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6