Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sync] 2021/02/11 #257

Merged
merged 52 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d9ab552
Update faq.md (#2820)
SebastianJL Jan 5, 2021
a9b9a7f
Update old pub link - Fixes #2377 (#2817)
parlough Jan 5, 2021
5c6f2db
Update language-tour.md (#2815)
Jan 6, 2021
46fe6f5
Add font-weight 700 Roboto to improve bold text clarity (#2818)
parlough Jan 6, 2021
3771282
Improve navbar font size (#2819)
parlough Jan 6, 2021
714e437
Remove link to GENERIC_METHODS.md (#2813)
kwalrath Jan 6, 2021
1b083aa
Update some links within deployment.md (#2836)
parlough Jan 6, 2021
72296bc
Remove warning about switch statements (#2838)
kwalrath Jan 6, 2021
e8c1c4b
Update compile image to use `dart compile` (#2840)
mit-mit Jan 7, 2021
ab42631
Update Shared-Packages tutorial to use new `dart` tool (#2839)
shubhanshu02 Jan 8, 2021
2e4b129
doc update to use new `dart` tool in `pub get` (#2826)
KevinRohn Jan 8, 2021
d41a387
add `dart` before `pub publish` (#2816)
Abhishek01039 Jan 8, 2021
3b818c8
updated pub-downgrade.md to new dart tool (#2847)
Jan 11, 2021
53f8e35
Update HTTP-Server tutorial to use new `dart` tool (#2848)
shubhanshu02 Jan 11, 2021
cc4817d
Iterables codelab example migration to Null Safety (#2805)
miquelbeltran Jan 11, 2021
d2345d4
updated pub-global.md to new `dart` tool (#2843)
Abhishek01039 Jan 12, 2021
534d27c
update dart-devtools.md to use new `dart` tool (#2841)
woinbo Jan 12, 2021
2694784
Clarify that migrating imposes an SDK version requirement (#2832)
mit-mit Jan 12, 2021
21b7f38
fix: tools.dart.dev and labs.dart.dev links (#2864)
brokeyourbike Jan 15, 2021
f32c17b
Migrate Async-Await Codelab to Null Safety (#2857)
miquelbeltran Jan 15, 2021
a7a576a
Migrate Iterable Collections Codelab to Null Safety (#2856)
miquelbeltran Jan 15, 2021
dc3ff6a
Update troubleshoot.md to use new dart tool (#2854)
woinbo Jan 19, 2021
c7f5304
Updated webdev.md to use new dart tool (#2870)
Abhishek01039 Jan 19, 2021
b4e59fa
Update build_runner.md to use new dart tools (#2877)
woinbo Jan 20, 2021
175d727
Document main channel builds (#2876)
mit-mit Jan 20, 2021
1071da2
Fixed typo (#2868)
codejunk1e Jan 20, 2021
ddb171e
Update CONTRIBUTING.md
kwalrath Jan 21, 2021
ac1467b
Migrate Dart Cheat-Sheet Codelab to Null Safety (#2880)
miquelbeltran Jan 22, 2021
1b9dd19
Update src/tools/pub/cmd/pub-uploader.md (#2883)
woinbo Jan 22, 2021
c758d17
Update site-shared (#2884)
kwalrath Jan 23, 2021
6d5806a
Add go/ link for `.packages` deprecation. (#2888)
sigurdm Jan 25, 2021
58e37be
Update diagnostic-messages.md (#2885)
kwalrath Jan 25, 2021
cfd6129
Add high-level overview of Dart (#2723)
Jan 27, 2021
32cb9b6
doc update to use new `dart` tool in `pub upgrade` and `pub cache` (#…
KevinRohn Jan 28, 2021
82abf59
Removed Reference to Deprecated Resource Package (#2893)
legolas108 Jan 28, 2021
5666ff5
Migrated language_tour code to null safety (#2891)
miquelbeltran Jan 28, 2021
067dc74
Update site-shared (#2894)
kwalrath Jan 28, 2021
f941f2e
Update _windows.md to use new dart tool (#2853)
woinbo Jan 28, 2021
b429e53
updated dart tools to debugging (#2850)
Abhishek01039 Jan 29, 2021
62ba5c0
Clean up ImmutablePoint.origin (#2895)
parlough Jan 29, 2021
cb2329e
Keep .pub-cache/bin at the end of your PATH (#2901)
jonasfj Feb 1, 2021
278545a
replace Travis with GitHub Actions for CI/CD (#2903)
AliAkberAakash Feb 1, 2021
0818bcb
Change dartfmt to dart format (#2904)
Sameerkash Feb 3, 2021
2fe4ba4
change instances of pub to dart pub (#2905)
Sameerkash Feb 3, 2021
32e76a5
[sync] 2021/02/04
Vadaski Feb 4, 2021
eea2920
[update] sync git submodule
Vadaski Feb 6, 2021
a0a29eb
[sync] 2021/02/11
Vadaski Feb 10, 2021
d983506
fixed as Alex suggestions
Vadaski Feb 10, 2021
9875592
fixed as Alex suggestions
Vadaski Feb 14, 2021
deb8d0b
💬 Suggestions apply
AlexV525 Feb 15, 2021
9e90295
Apply suggestions from code review
AlexV525 Feb 15, 2021
751ae93
💬 Text updates.
AlexV525 Feb 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ matrix:
dart: stable
- env: TASK="./tool/analyze-and-test-examples.sh --null-safety"
dart: beta
# - env: TASK="./tool/check-code.sh --null-safety"
# dart: stable
# - env: TASK="./tool/check-code.sh --null-safety"
# dart: beta
- env: TASK="./tool/analyze-and-test-examples.sh --null-safety"
dart: dev

before_install:
- source ./tool/env-set.sh
Expand Down
14 changes: 10 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,30 @@ More info:

* To avoid wasting your time, talk with us before you make any nontrivial
pull request. The [issue tracker][] is a good way to track your progress
publicly, but we can also communicate other ways such as email and
[Gitter][].
publicly, but we also use the #hackers-devrel channel
[on Flutter's Discord server][].
* We use the usual [GitHub pull request][] process.
* We follow the [Google Developer Documentation Style Guide][].
* We follow the [Google Developer Documentation Style Guide][],
with some additional conventions that we try to document
[in the site-shared repo][].
In particular, we use [semantic line breaks][].
* For more ways to contribute to Dart, see the
[dart-lang/sdk Contributing page][].

[beginner]: https://github.com/dart-lang/site-www/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20label%3A%22help%20wanted%22%20label%3Abeginner%20
[dart-lang/sdk Contributing page]: https://github.com/dart-lang/sdk/wiki/Contributing
[GitHub pull request]: https://help.github.com/articles/about-pull-requests/
[Gitter]: https://gitter.im/dart-lang/home
[Google Developer Documentation Style Guide]: https://developers.google.com/style/
[help wanted]: https://github.com/dart-lang/site-www/issues?utf8=%E2%9C%93&q=is%3Aopen%20is%3Aissue%20label%3A%22help%20wanted%22%20
[in the site-shared repo]: https://github.com/dart-lang/site-shared/blob/master/doc
[issue tracker]: https://github.com/dart-lang/site-www/issues
[on Flutter's Discord server]: https://github.com/flutter/flutter/wiki/Chat
[Report issues]: https://github.com/dart-lang/site-www/issues/new
[semantic line breaks]: https://github.com/dart-lang/site-shared/blob/master/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks
[sign the CLA]: https://developers.google.com/open-source/cla/individual
[www]: https://dart.dev


## Updating code samples

If your PR changes Dart code within a page, you'll probably need to change the code in two places:
Expand Down
3 changes: 1 addition & 2 deletions examples/misc/lib/language_tour/classes/immutable_point.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// ignore_for_file: sort_constructors_first
class ImmutablePoint {
static final ImmutablePoint origin =
const ImmutablePoint(0, 0);
static const ImmutablePoint origin = ImmutablePoint(0, 0);

final double x, y;

Expand Down
1 change: 0 additions & 1 deletion examples/misc/lib/language_tour/variables.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ void miscDeclAnalyzedButNotTested() {

{
// #docregion const-dart-25
// Valid compile-time constants as of Dart 2.5.
const Object i = 3; // Where i is a const Object with an int value...
const list = [i as int]; // Use a typecast.
const map = {if (i is int) i: "int"}; // Use is and collection if.
Expand Down
2 changes: 1 addition & 1 deletion examples/misc/lib/samples/spacecraft.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Orbiter extends Spacecraft {
// #enddocregion extends

// #docregion mixin
class Piloted {
mixin Piloted {
int astronauts = 1;
void describeCrew() {
print('Number of astronauts: $astronauts');
Expand Down
1 change: 1 addition & 0 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@

{ "source": "/go/analysis-server-protocol", "destination": "https://htmlpreview.github.io/?https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/doc/api.html", "type": 301 },
{ "source": "/go/flutter-upper-bound-deprecation", "destination": "https://github.com/flutter/flutter/issues/68143", "type": 301 },
{ "source": "/go/dot-packages-deprecation", "destination": "https://github.com/dart-lang/language/blob/master/accepted/future-releases/language-versioning/package-config-file-v2.md", "type": 301 },
{ "source": "/go/dart-fix", "destination": "https://github.com/dart-lang/sdk/blob/master/pkg/dartdev/doc/dart-fix.md", "type": 301 },
{ "source": "/go/experiments", "destination": "/tools/experiment-flags", "type": 301 },
{ "source": "/go/null-safety-migration", "destination": "/null-safety/migration-guide", "type": 301 },
Expand Down
39 changes: 39 additions & 0 deletions null_safety_examples/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
include: package:pedantic/analysis_options.1.8.0.yaml

analyzer:
exclude: [build/**]
strong-mode:
implicit-casts: false

linter:
# Rules and documentation: http://dart-lang.github.io/linter/lints
rules:
- annotate_overrides
- await_only_futures
- camel_case_types
- cancel_subscriptions
- close_sinks
- comment_references
- constant_identifier_names
- control_flow_in_finally
- empty_statements
- hash_and_equals
- implementation_imports
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- non_constant_identifier_names
- one_member_abstracts
- only_throw_errors
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
- sort_constructors_first
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- type_annotate_public_apis
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_getters_setters
- unnecessary_new
1 change: 1 addition & 0 deletions null_safety_examples/async_await/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: ../analysis_options.yaml
25 changes: 25 additions & 0 deletions null_safety_examples/async_await/bin/async_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Future<void> printOrderMessage() async {
print('Awaiting user order...');
// #docregion swap-stmts
var order = await fetchUserOrder();
// print('Awaiting user order...');
// #enddocregion swap-stmts
print('Your order is: $order');
}

Future<String> fetchUserOrder() {
// Imagine that this function is more complex and slow.
return Future.delayed(Duration(seconds: 4), () => 'Large Latte');
}

Future<void> main() async {
countSeconds(4);
await printOrderMessage();
}

// You can ignore this function - it's here to visualize delay time in this example.
void countSeconds(int s) {
for (var i = 1; i <= s; i++) {
Future.delayed(Duration(seconds: i), () => print(i));
}
}
19 changes: 19 additions & 0 deletions null_safety_examples/async_await/bin/futures_intro.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// #docregion ''
Future<void> fetchUserOrder() {
// Imagine that this function is fetching user info from another service or database.
return Future.delayed(Duration(seconds: 2), () => print('Large Latte'));
}
// #enddocregion ''

// #docregion error
Future<void> fetchUserOrderError() {
// Imagine that this function is fetching user info but encounters a bug
return Future.delayed(Duration(seconds: 2),
() => throw Exception('Logout failed: user ID is invalid'));
}
// #docregion ''

void main() {
fetchUserOrder();
print('Fetching user order...');
}
20 changes: 20 additions & 0 deletions null_safety_examples/async_await/bin/get_order.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Future<String> createOrderMessage() async {
var order = await fetchUserOrder();
return 'Your order is: $order';
}

Future<String> fetchUserOrder() =>
// Imagine that this function is more complex and slow.
Future.delayed(
Duration(seconds: 2),
() => 'Large Latte',
);

// #docregion main-sig
Future<void> main() async {
// #enddocregion main-sig
print('Fetching user order...');
// #docregion print-order
print(await createOrderMessage());
// #enddocregion print-order
}
21 changes: 21 additions & 0 deletions null_safety_examples/async_await/bin/get_order_sync_bad.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// This example shows how *not* to write asynchronous Dart code.

// #docregion no-warning
String createOrderMessage() {
var order = fetchUserOrder();
return 'Your order is: $order';
}

Future<String> fetchUserOrder() =>
// Imagine that this function is more complex and slow.
Future.delayed(
Duration(seconds: 2),
() => 'Large Latte',
);

// #docregion main-sig
void main() {
// #enddocregion main-sig
print('Fetching user order...');
print(createOrderMessage());
}
24 changes: 24 additions & 0 deletions null_safety_examples/async_await/bin/try_catch.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Future<void> printOrderMessage() async {
// #docregion try-catch
try {
var order = await fetchUserOrder();
print('Awaiting user order...');
print(order);
} catch (err) {
print('Caught error: $err');
}
// #enddocregion try-catch
}

Future<String> fetchUserOrder() {
// Imagine that this function is more complex.
var str = Future.delayed(
Duration(seconds: 4),
// ignore: only_throw_errors
() => throw 'Cannot locate user order');
return str;
}

Future<void> main() async {
await printOrderMessage();
}
1 change: 1 addition & 0 deletions null_safety_examples/async_await/dart_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: ../dart_test_base_browser.yaml
10 changes: 10 additions & 0 deletions null_safety_examples/async_await/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: async_await
description: dart.dev example code.

environment:
sdk: ">=2.12.0-0 <3.0.0"

dev_dependencies:
examples_util: {path: ../util}
pedantic: ^1.10.0-nullsafety.3
test: ^1.16.0-nullsafety.13
55 changes: 55 additions & 0 deletions null_safety_examples/async_await/test/async_await_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'package:test/test.dart';
import 'package:examples_util/print_matcher.dart' as m;

import '../bin/async_example.dart' as async_example;
import '../bin/futures_intro.dart' as futures_intro;
import '../bin/get_order_sync_bad.dart' as get_order_sync_bad;
import '../bin/get_order.dart' as get_order;
import '../bin/try_catch.dart' as try_catch;

void main() {
test('async_example', () {
final output = '''
Awaiting user order...
1
2
3
4
Your order is: Large Latte
''';
expect(async_example.main, m.printsLines(output));
});

test('futures_intro', () {
final output = '''
Fetching user order...
Large Latte
''';
expect(
() => Future.wait([
Future.delayed(Duration(seconds: 4)),
Future.sync(futures_intro.main),
]),
m.printsLines(output));
});

test('get_order_sync_bad', () {
final output = '''
Fetching user order...
Your order is: Instance of 'Future<String>'
''';
expect(get_order_sync_bad.main, m.printsLines(output));
});

test('get_order', () {
final output = '''
Fetching user order...
Your order is: Large Latte
''';
expect(get_order.main, m.printsLines(output));
});

test('try_catch', () {
expect(try_catch.main, m.prints('Caught error: Cannot locate user order'));
});
}
2 changes: 2 additions & 0 deletions null_safety_examples/dart_test_base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# When analyzing build/test logs, the expanded reporter is better:
reporter: expanded
13 changes: 13 additions & 0 deletions null_safety_examples/dart_test_base_browser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
include: dart_test_base.yaml

tags:
browser:

# Chrome option required because Travis is't running under sudo
# https://docs.travis-ci.com/user/chrome#Sandboxing
define_platforms:
travischrome:
name: Chrome for Travis w/o sudo
extends: chrome
settings:
arguments: --no-sandbox
1 change: 1 addition & 0 deletions null_safety_examples/iterables/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: ../analysis_options.yaml
10 changes: 10 additions & 0 deletions null_safety_examples/iterables/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: iterables
description: dart.dev example code.

environment:
sdk: ">=2.12.0-0 <3.0.0"

dev_dependencies:
examples_util: {path: ../util}
pedantic: ^1.10.0-nullsafety.3
test: ^1.16.0-nullsafety.13
Loading