Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

Commit

Permalink
Fix #47: mixin compile-time error (#48)
Browse files Browse the repository at this point in the history
Additionally,
* Update examples in documentation
* Update to_string_helper and to_string_helper_generator to version 1.1.1
  • Loading branch information
xuanswe authored Jun 21, 2020
1 parent c2f56cb commit 8d8198f
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 15 deletions.
4 changes: 2 additions & 2 deletions example_with_generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ environment:
sdk: ">=2.0.0 <3.0.0"

dependencies:
to_string_helper: ^1.0.0
to_string_helper: ^1.1.0

dev_dependencies:
test: ^1.0.0

build_runner: ^1.0.0
to_string_helper_generator: ^1.0.0
to_string_helper_generator: ^1.1.0

#dependency_overrides:
# to_string_helper:
Expand Down
2 changes: 1 addition & 1 deletion example_without_generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ environment:
sdk: ">=2.0.0 <3.0.0"

dependencies:
to_string_helper: ^1.0.0
to_string_helper: ^1.1.0

dev_dependencies:
test: ^1.0.0
Expand Down
3 changes: 3 additions & 0 deletions generator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.1.1
* Fix #47: mixin compile-time error

# 1.1.0
* Generate code for annotation `@ToStringMixin`.

Expand Down
2 changes: 1 addition & 1 deletion generator/lib/src/to_string_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ToStringGenerator extends GeneratorForAnnotation<ToString> {
sb
..writeln('@override')
..writeln('String toString() {')
..writeln('return $methodName(this);')
..writeln('return $methodName(this as $classname);')
..writeln('}');

// close mixin
Expand Down
4 changes: 2 additions & 2 deletions generator/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: to_string_helper_generator
version: 1.1.0
version: 1.1.1
description: >
Generate code for package to_string_helper.
This package is not needed if you want to use to_string_helper without code generation.
Expand All @@ -10,7 +10,7 @@ environment:
sdk: ">=2.0.0 <3.0.0"

dependencies:
to_string_helper: ^1.0.0
to_string_helper: ^1.1.0
analyzer: ^0.39.7
build: ^1.0.0
source_gen: ^0.9.5
Expand Down
3 changes: 3 additions & 0 deletions to_string_helper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.1.1
* Update examples in documentation

# 1.1.0
* Added annotation `@ToStringMixin`.

Expand Down
10 changes: 5 additions & 5 deletions to_string_helper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Otherwise, you only need this package.
1. Add dependency to your `pubspec.yaml`
```yaml
dependencies:
to_string_helper: ^1.0.0
to_string_helper: ^1.1.0
```
2. Configure your class
```dart
Expand Down Expand Up @@ -40,10 +40,10 @@ Otherwise, you only need this package.
1. Add dependencies to your `pubspec.yaml`
```yaml
dependencies:
to_string_helper: ^1.0.0
to_string_helper: ^1.1.0
dev_dependencies:
build_runner: ^1.0.0
to_string_helper_generator: ^1.0.0
to_string_helper_generator: ^1.1.0
```
2. Configure your class
* With mixin
Expand All @@ -67,8 +67,8 @@ Otherwise, you only need this package.
class Bike {/*...*/}
```
3. Generate code (see [build_runner](https://pub.dev/packages/build_runner))
* `pub run build_runner build`: run a single build and exit.
* `pub run build_runner watch`: continuously run builds as you edit files.
* `pub run build_runner build` or `flutter packages run build_runner build`: run a single build and exit.
* `pub run build_runner watch` or `flutter packages run build_runner watch`: continuously run builds as you edit files.
4. Use the generated code to produce output of `toString`
* With mixin
```dart
Expand Down
17 changes: 14 additions & 3 deletions to_string_helper/example/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* `pubspec.yaml`
```yaml
dependencies:
to_string_helper: ^1.0.0
to_string_helper: ^1.1.0
```
* `bike.dart`
Expand All @@ -22,17 +22,21 @@
}
}
```
* Output
```
Bike{wheels=2, false}
```
# Simple example (with code generator)
* Require package [to_string_helper_generator](https://pub.dev/packages/to_string_helper_generator)
* `pubspec.yaml`
```yaml
dependencies:
to_string_helper: ^1.0.0
to_string_helper: ^1.1.0
dev_dependencies:
build_runner: ^1.0.0
to_string_helper_generator: ^1.0.0
to_string_helper_generator: ^1.1.0
```
* `bike.dart` with mixin
```dart
Expand Down Expand Up @@ -69,3 +73,10 @@
}
}
```
* Generate code (see [build_runner](https://pub.dev/packages/build_runner))
* `pub run build_runner build` or `flutter packages run build_runner build`: run a single build and exit.
* `pub run build_runner watch` or `flutter packages run build_runner watch`: continuously run builds as you edit files.
* Output
```
Bike{hasEngine=false}
```
2 changes: 1 addition & 1 deletion to_string_helper/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: to_string_helper
version: 1.1.0
version: 1.1.1
description: Flexibly configure output of toString method (with or without code generation) (with or without mixin).
homepage: https://github.com/zenonine/to_string_helper
repository: https://github.com/zenonine/to_string_helper/tree/master/to_string_helper
Expand Down

0 comments on commit 8d8198f

Please sign in to comment.