Various documentation improvements. (#15071)

For example, mention the icon used for the drawer menu in the docs (this helps people writing unit tests); add DefaultAssetBundle sample code.
This commit is contained in:
Ian Hickson
2018-03-11 03:19:18 -07:00
committed by GitHub
parent 48bb5b7926
commit ded3905102
9 changed files with 88 additions and 26 deletions

View File

@@ -8,6 +8,8 @@ import 'dart:io';
import 'package:path/path.dart' as path;
// To run this: bin/cache/dart-sdk/bin/dart dev/bots/analyze-sample-code.dart
final String _flutterRoot = path.dirname(path.dirname(path.dirname(path.fromUri(Platform.script))));
final String _flutter = path.join(_flutterRoot, 'bin', Platform.isWindows ? 'flutter.bat' : 'flutter');
@@ -61,7 +63,6 @@ class Section {
const String kDartDocPrefix = '///';
const String kDartDocPrefixWithSpace = '$kDartDocPrefix ';
/// To run this: bin/cache/dart-sdk/bin/dart dev/bots/analyze-sample-code.dart
Future<Null> main() async {
final Directory temp = Directory.systemTemp.createTempSync('analyze_sample_code_');
int exitCode = 1;
@@ -136,8 +137,11 @@ Future<Null> main() async {
}
buffer.add('// generated code');
buffer.add('import \'dart:async\';');
buffer.add('import \'dart:convert\';');
buffer.add('import \'dart:math\' as math;');
buffer.add('import \'dart:typed_data\';');
buffer.add('import \'dart:ui\' as ui;');
buffer.add('import \'package:flutter_test/flutter_test.dart\' hide TypeMatcher;');
for (FileSystemEntity file in flutterPackage.listSync(recursive: false, followLinks: false)) {
if (file is File && path.extension(file.path) == '.dart') {
buffer.add('');
@@ -158,6 +162,8 @@ name: analyze_sample_code
dependencies:
flutter:
sdk: flutter
flutter_test:
sdk: flutter
''');
print('Found $sampleCodeSections sample code sections.');
final Process process = await Process.start(
@@ -257,7 +263,10 @@ void processBlock(Line line, List<String> block, List<Section> sections) {
if (block.first.startsWith('new ') || block.first.startsWith('const ')) {
_expressionId += 1;
sections.add(new Section(line, 'dynamic expression$_expressionId = ', block.toList(), ';'));
} else if (block.first.startsWith('class ') || block.first.startsWith('const ')) {
} else if (block.first.startsWith('await ')) {
_expressionId += 1;
sections.add(new Section(line, 'Future<Null> expression$_expressionId() async { ', block.toList(), ' }'));
} else if (block.first.startsWith('class ')) {
sections.add(new Section(line, null, block.toList(), null));
} else {
final List<String> buffer = <String>[];