pubspec_generator 1.0.1+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 51

pubspec_generator #

Code generator pubspec.yaml.g.dart from pubspec.yaml #

Add the following lines to the pubspec.yaml:

dev_dependencies:
  build_runner: '>=1.0.0 <2.0.0'
  pubspec_generator: '>=1.0.0 <2.0.0'

and then execute in the console:

pub run build_runner build

Result example: #

/// Current app version
const String version = r'0.0.1';

/// The major version number: "1" in "1.2.3".
const int major = 0;

/// The minor version number: "2" in "1.2.3".
const int minor = 0;

/// The patch version number: "3" in "1.2.3".
const int patch = 1;

/// The pre-release identifier: "foo" in "1.2.3-foo".
const List<String> pre = <String>[];

/// The build identifier: "foo" in "1.2.3+foo".
const List<String> build = <String>[];

/// Build date in Unix Time
const int date = 1590350655;

/// Get pubspec.yaml as Map<String, dynamic>
const Map<String, dynamic> pubspec = <String, dynamic>{
  'name': r'playground',
  'description': r'dart playground',
  'version': r'0.0.1',
  'author': r'Plague Fox <Plugfox@gmail.com>',
  'homepage': r'https://github.com/plugfox/',
  'publish_to': r'none',
  'environment': <String, dynamic>{
      'sdk': r'>=2.6.0 <3.0.0',
  },
  'dependencies': <String, dynamic>{
      'meta': r'>=1.0.0 <2.0.0',
  },
  'dev_dependencies': <String, dynamic>{
      'test': r'any',
      'build_runner': r'>=1.0.0 <2.0.0',
      'build_web_compilers': r'>=2.6.1 <3.0.0',
      'pubspec_generator': r'>=1.0.0 <2.0.0',
  },
};

1.0.1+1 #

2020-05-24

Update README.md

1.0.1 #

2020-05-24

Add build date (in Unix time)

1.0.0 #

2020-05-24

Initial release with main functional

example/example.dart

/// Current app version
const String version = r'0.0.1';

/// The major version number: "1" in "1.2.3".
const int major = 0;

/// The minor version number: "2" in "1.2.3".
const int minor = 0;

/// The patch version number: "3" in "1.2.3".
const int patch = 1;

/// The pre-release identifier: "foo" in "1.2.3-foo".
const List<String> pre = <String>[];

/// The build identifier: "foo" in "1.2.3+foo".
const List<String> build = <String>[];

/// Build date in Unix Time
const int date = 1590350655;

/// Get pubspec.yaml as Map<String, dynamic>
const Map<String, dynamic> pubspec = <String, dynamic>{
  'name': r'playground',
  'description': r'dart playground',
  'version': r'0.0.1',
  'author': r'Plague Fox <Plugfox@gmail.com>',
  'homepage': r'https://github.com/plugfox/',
  'publish_to': r'none',
  'environment': <String, dynamic>{
    'sdk': r'>=2.6.0 <3.0.0',
  },
  'dependencies': <String, dynamic>{
    'meta': r'>=1.0.0 <2.0.0',
  },
  'dev_dependencies': <String, dynamic>{
    'test': r'any',
    'build_runner': r'>=1.0.0 <2.0.0',
    'build_web_compilers': r'>=2.6.1 <3.0.0',
    'pubspec_generator': r'>=1.0.0 <2.0.0',
  },
};

Use this package as a library

1. Depend on it

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


dependencies:
  pubspec_generator: ^1.0.1+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:pubspec_generator/pubspec_generator.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
2
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]
51
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.13

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because of the import of dart:io via the import chain package:pubspec_generator/pubspec_generator.dartpackage:pubspec_generator/builder.dartpackage:pubspec_generator/src/pubspec.dartpackage:build/build.dartpackage:build/src/generate/run_post_process_builder.dartpackage:build/src/builder/post_process_builder.dartpackage:build/src/builder/builder.dartpackage:build/src/builder/build_step.dartpackage:build/src/asset/reader.dartpackage:glob/glob.dartpackage:glob/src/list_tree.dartpackage:glob/src/io.dartpackage:glob/src/io_export.dartdart:io

Package not compatible with runtime web

Because of the import of dart:io via the import chain package:pubspec_generator/pubspec_generator.dartpackage:pubspec_generator/builder.dartpackage:pubspec_generator/src/pubspec.dartpackage:build/build.dartpackage:build/src/generate/run_post_process_builder.dartpackage:build/src/builder/post_process_builder.dartpackage:build/src/builder/builder.dartpackage:build/src/builder/build_step.dartpackage:build/src/asset/reader.dartpackage:glob/glob.dartpackage:glob/src/list_tree.dartpackage:glob/src/io.dartpackage:glob/src/io_export.dartdart:io

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
build >=1.0.0 <2.0.0 1.3.0
multiline >=1.0.1 <2.0.0 1.0.1+1
pub_semver >=1.4.3 <2.0.0 1.4.4
yaml >=2.2.0 <3.0.0 2.2.1
Transitive dependencies
_fe_analyzer_shared 5.0.0
analyzer 0.39.11
args 1.6.0
async 2.4.1
charcode 1.1.3
collection 1.14.13
convert 2.1.1
crypto 2.1.5
csslib 0.16.1
glob 1.2.0
html 0.14.0+3
js 0.6.2
logging 0.11.4
meta 1.1.8
node_interop 1.1.1
node_io 1.1.1
package_config 1.9.3
path 1.7.0
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0
watcher 0.9.7+15
Dev dependencies
build_test >=1.0.0 <2.0.0
pedantic >=1.0.0 <2.0.0 1.9.0 1.9.1
test >=1.0.0 <2.0.0