Skip to content

Commit

Permalink
[Pigeon] Added comment to opt out of nnbd for now (flutter#209)
Browse files Browse the repository at this point in the history
* [Pigeon] Added comment to opt out of nnbd for now.

* moved language directive
  • Loading branch information
gaaclarke authored Sep 21, 2020
1 parent 818c483 commit 32d0f56
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/pigeon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.1.7

* Fixed Dart compilation for later versions that support null safety, opting out
of it for now.

## 0.1.6

* Fixed unused variable linter warning in Dart code under certain conditions.
Expand Down
1 change: 1 addition & 0 deletions packages/pigeon/lib/dart_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ void generateDart(Root root, StringSink sink) {
indent.writeln('// $seeAlsoWarning');
indent.writeln(
'// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import');
indent.writeln('// @dart = 2.8');
indent.writeln('import \'dart:async\';');
indent.writeln('import \'package:flutter/services.dart\';');
indent.writeln(
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/lib/generator_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'dart:mirrors';
import 'ast.dart';

/// The current version of pigeon.
const String pigeonVersion = '0.1.6';
const String pigeonVersion = '0.1.7';

/// Read all the content from [stdin] to a String.
String readStdin() {
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: pigeon
version: 0.1.6
version: 0.1.7
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
homepage: https://github.com/flutter/packages/tree/master/packages/pigeon
dependencies:
Expand Down
17 changes: 17 additions & 0 deletions packages/pigeon/test/dart_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,21 @@ void main() {
expect(code, matches('\'${Keys.result}\': output._toMap()'));
expect(code, contains('return <dynamic, dynamic>{};'));
});

test('opt out of nndb', () {
final Class klass = Class()
..name = 'Foobar'
..fields = <Field>[
Field()
..name = 'field1'
..dataType = 'dataType1'
];
final Root root = Root()
..apis = <Api>[]
..classes = <Class>[klass];
final StringBuffer sink = StringBuffer();
generateDart(root, sink);
final String code = sink.toString();
expect(code, contains('// @dart = 2.8'));
});
}

0 comments on commit 32d0f56

Please sign in to comment.