replace_content 0.0.1

  • Installing
  • Versions
  • 41


replace_content is a pub transformer that replaces the contents of some target files with the contents of matching source files based on the transformation mode.

Given a target file path/to/file.ext, its content will be replaced with the content of path/to/file.{mode}.ext where {mode} is the transformation mode passed to pub serve and pub build. path/to/file.{mode}.ext and other files of the same path format will be excluded from the rest of the build process.

The transformer has two parameters

  • targets: a list of target files or a single target file.
  • keep_source: whether source files should be kept. Default is false.


Suppose that your project supports two transformation modes debug and release, and you want to change the contents of two target files based on the transformation mode. Those files are

  • lib/config.dart
  • web/sample.jpg

Your project should have these files

  • lib/config.dart: target file (text based)
  • lib/config.debug.dart: source file to use if mode is debug
  • lib/config.release.dart: source file to use if mode is release
  • web/sample.jpg: target file (binary)
  • web/sample.debug.jpg: source file to use if mode is debug
  • web/sample.release.jpg: source file to use if mode is release

In pubspec.yaml, add the transformer and specify the target files

- replace_content:
    - lib/config.dart
    - web/sample.jpg

After this transformer runs, the output will contain

  • lib/config.dart: contains the content of lib/config.debug.dart
  • web/sample.jpg: contains the content of web/sample.debug.jpg

Features and bugs

Please file feature requests and bugs at the issue tracker.



  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

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

  replace_content: "^0.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:replace_content/replace_content.dart';
Version Uploaded Documentation Archive
0.0.1 Feb 18, 2017 Go to the documentation of replace_content 0.0.1 Download replace_content 0.0.1 archive


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

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
97 / 100
Reflects how tidy and up-to-date the package is. [more]
60 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:replace_content/replace_content.dart.


  • Package is getting outdated.

    The package was released 72 weeks ago.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use replace_content.dart.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 hints.

    Run dartfmt to format lib/replace_content.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0
barback >=0.15.2+9 <0.16.0 0.15.2+16
Transitive dependencies
async 2.0.7
charcode 1.1.2
collection 1.14.10
path 1.6.1
pool 1.3.5
source_span 1.4.0
stack_trace 1.9.2