Skip to content

Commit 331b94c

Browse files
authored
Fixing some typos and removing references to "checked mode" (cfug#1191)
* Fixing some typos and removing references to "checked mode", which doesn't exist in Dart 2. * Incorporating feedback.
1 parent 74b3821 commit 331b94c

File tree

6 files changed

+83
-67
lines changed

6 files changed

+83
-67
lines changed

.firebaserc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"default": "sweltering-fire-2088",
44
"flutter-io": "sweltering-fire-2088",
55
"staging-1": "flutter-io-staging-1",
6-
"pc2": "ng2-io"
6+
"pc2": "ng2-io",
7+
"sz" : "sz-flutter",
8+
"sz2" : "sz-flutter-2"
79
}
810
}

src/debugging.md

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ check out [Flutter Performance Profiling](/ui-performance/).
1919
## The Dart Analyzer
2020

2121
Before running your applications, test your code with `flutter analyze`. This
22-
tool (which is a wrapper around the `dartanalyzer` tool) will analyze your code
23-
and help you find possible mistakes. If you're using a [Flutter enabled IDE/editor](/get-started/editor/),
22+
tool (which is a wrapper around the `dartanalyzer` tool) analyzes your code
23+
and helps you find possible mistakes. If you're using a
24+
[Flutter enabled IDE/editor](/get-started/editor/),
2425
this is already happening for you.
2526

2627
The Dart analyzer makes heavy use of type annotations that you put in
@@ -44,8 +45,8 @@ information on Observatory, see
4445

4546
If you use Observatory for profiling, make sure to run your
4647
application in profile mode, by passing `--profile` to the `flutter
47-
run` command. Otherwise, the main thing that will appear on your
48-
profile will be the debug asserts verifying the framework's various
48+
run` command. Otherwise, the main thing that appears on your
49+
profile is the debug asserts verifying the framework's various
4950
invariants (see "Debug mode assertions" below).
5051

5152
### `debugger()` statement
@@ -69,7 +70,7 @@ void someFunction(double offset) {
6970

7071
## `print` and `debugPrint` with `flutter logs`
7172

72-
The Dart `print()` function will output to the system console, which
73+
The Dart `print()` function outputs to the system console, which
7374
you can view using `flutter logs` (which is basically a wrapper around
7475
`adb logcat`).
7576

@@ -92,13 +93,17 @@ of the object.
9293
## Debug mode assertions
9394

9495
During development, you are highly encouraged to use Flutter's "debug"
95-
mode, sometimes referred to as "checked" mode. This is the default if
96-
you use `flutter run`. In this mode, the Dart `assert` statement is
97-
enabled, and the Flutter framework uses this to perform many runtime
98-
checks verifying that invariants are not being violated.
99-
100-
When an invariant is violated, it is reported to the console, with
101-
some context information to help with tracking down the source of the
96+
mode. This is the default if you use `flutter run` or the bug icon
97+
in Android Studio. Some tools support assert statements through the
98+
command-line flag `--enable-asserts`.
99+
In this mode, Dart assert statements are enabled, and the Flutter
100+
framework evaluates the argument to each assert statement encountered during
101+
execution, throwing an exception if the result is false. This allows
102+
developers to enable or disable invariant checking, such that the associated
103+
performance cost is only paid during debugging sessions.
104+
105+
When an invariant is violated, it's reported to the console, with
106+
some context information to help track down the source of the
102107
problem.
103108

104109
To turn off debug mode, and use release mode, run your application
@@ -107,6 +112,9 @@ debugger. An in-between mode that turns off all the debugging aids
107112
_except_ the Observatory, known as "profile mode", is available also,
108113
using `--profile` instead of `--release`.
109114

115+
For more information, see
116+
[Flutter's modes](https://github.com/flutter/flutter/wiki/Flutter's-modes).
117+
110118
## Debugging application layers
111119

112120
Each layer of the Flutter framework provides a function to dump its
@@ -151,7 +159,7 @@ class AppHome extends StatelessWidget {
151159
}
152160
```
153161

154-
...will output something like this (the precise details will vary on
162+
...outputs something like this (the precise details vary by
155163
the version of the framework, the size of the device, and so forth):
156164

157165
```
@@ -246,8 +254,8 @@ from being pressed to being released, it coincides with the
246254
[`FlatButton`](https://docs.flutter.io/flutter/material/FlatButton-class.html)
247255
object calling
248256
[`setState()`](https://docs.flutter.io/flutter/widgets/State/setState.html)
249-
and thus marking itself dirty. That is why if you look at the dump you
250-
will see that specific object marked "dirty". You can also see what
257+
and thus marking itself dirty. That is why, when you look at the dump you
258+
should see that specific object marked as "dirty". You can also see what
251259
gesture listeners have been registered; in this case, a single
252260
GestureDetector is listed, and it is listening only to a "tap" gesture
253261
("tap" is the output of a `TapGestureDetector`'s `toStringShort`
@@ -754,19 +762,19 @@ flag, which causes layers to be overlayed with a rotating set of
754762
colors whenever they are repainted.
755763

756764
All of these flags only work in debug mode. In general, anything in
757-
the Flutter framework that starts with "`debug...`" will only work in
765+
the Flutter framework that starts with "`debug...`" only works in
758766
debug mode.
759767

760768
## Debugging animations
761769

762-
The easiest way to debug animations is to slow them way down. To do
763-
that, set the
770+
The easiest way to debug animations is to slow them down. To do that,
771+
set the
764772
[`timeDilation`](https://docs.flutter.io/flutter/scheduler/timeDilation.html)
765773
variable (from the `scheduler` library) to a number greater than 1.0,
766774
for instance, 50.0. It's best to only set this once on app startup. If
767775
you change it on the fly, especially if you reduce it while animations
768776
are running, it's possible that the framework will observe time going
769-
backwards, which will probably result in asserts and generally will
777+
backwards, which will probably result in asserts and generally
770778
interfere with your efforts.
771779

772780
## Debugging performance problems
@@ -776,7 +784,7 @@ set the
776784
[`debugPrintMarkNeedsLayoutStacks`](https://docs.flutter.io/flutter/rendering/debugPrintMarkNeedsLayoutStacks.html)
777785
and
778786
[`debugPrintMarkNeedsPaintStacks`](https://docs.flutter.io/flutter/rendering/debugPrintMarkNeedsPaintStacks.html)
779-
flags respectively. These will log a stack trace to the console any
787+
flags, respectively. These log a stack trace to the console any
780788
time a render box is asked to relayout and repaint. You can use the
781789
`debugPrintStack()` method from the `services` library to print your
782790
own stack traces on demand, if this kind of approach is useful to you.
@@ -828,7 +836,7 @@ Timeline.finishSync();
828836
Then open your app's Observatory's timeline page, check the 'Dart'
829837
recording option and perform the function you want to measure.
830838

831-
Refreshing the page will display the chronological timeline records
839+
Refreshing the page displays the chronological timeline records
832840
of your app in Chrome's [tracing tool](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool).
833841

834842
Be sure to `flutter run` your app with the `--profile` flag to ensure
@@ -848,18 +856,18 @@ application in a stack and putting a widget on your stack that was
848856
created by calling
849857
[`PerformanceOverlay.allEnabled()`](https://docs.flutter.io/flutter/widgets/PerformanceOverlay/PerformanceOverlay.allEnabled.html).)
850858

851-
This will show two graphs. The top one is the time spent by the GPU
859+
This shows two graphs. The top one is the time spent by the GPU
852860
thread, the bottom one is the time spent by the CPU thread. The white
853861
lines across the graphs show 16ms increments along the vertical axis;
854862
if the graph ever goes over one of these lines then you are running at
855863
less than 60Hz. The horizontal axis represents frames. The graph is
856864
only updated when your application paints, so if it is idle the graph
857-
will stop moving.
865+
stops moving.
858866

859867
This should always be done in release mode, since in debug mode
860868
performance is intentionally sacrificed in exchange for expensive
861869
asserts that are intended to aid development, and thus the results
862-
will be misleading.
870+
are misleading.
863871

864872
## Material grid
865873

@@ -871,7 +879,7 @@ over the application to help verify alignments. To that end, the
871879
[`MaterialApp`
872880
constructor](https://docs.flutter.io/flutter/material/MaterialApp/MaterialApp.html)
873881
has a `debugShowMaterialGrid` argument which, when set to `true` in debug
874-
mode, will overlay such a grid.
882+
mode, overlays such a grid.
875883

876884
You can also overlay such a grid on non-Material applications by using
877885
the

src/flutter-for-ios.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,13 +1934,13 @@ class _SampleAppPageState extends State<SampleAppPage> {
19341934
return _errorText;
19351935
}
19361936
1937-
bool isEmail(String em) {
1937+
bool isEmail(String emailString) {
19381938
String emailRegexp =
19391939
r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$';
19401940
1941-
RegExp regExp = RegExp(p);
1941+
RegExp regExp = RegExp(emailRegexp);
19421942
1943-
return regExp.hasMatch(em);
1943+
return regExp.hasMatch(emailString);
19441944
}
19451945
}
19461946
{% endprettify %}

src/flutter-for-react-native/index.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This document is for React Native (RN) developers looking to apply their existin
99
This document can be used as a cookbook by jumping around and finding questions that are most relevant to your needs.
1010

1111

12-
*****
12+
*****
1313

1414
* TOC Placeholder
1515
{:toc}
@@ -232,11 +232,11 @@ _getIPAddress() {
232232

233233
Try it out in [DartPad](https://dartpad.dartlang.org/b68eb981456c5eec03daa3c05ee59486).
234234

235-
For more information, see the documentation on [Futures](https://www.dartlang.org/tutorials/language/futures).
235+
For more information, see the documentation on [Futures](https://www.dartlang.org/tutorials/language/futures).
236236

237237
#### `async` and `await`
238238

239-
The `async` function declaration defines an asynchronous function.
239+
The `async` function declaration defines an asynchronous function.
240240

241241
In JavaScript, the `async` function returns a `Promise`. The `await` operator is
242242
used to wait for a `Promise`.
@@ -389,18 +389,18 @@ void main() {
389389

390390

391391

392-
The following images show the Android and iOS UI for the basic Flutter "Hello world!" app.
392+
The following images show the Android and iOS UI for the basic Flutter "Hello world!" app.
393393

394394
|Android |iOS |
395395
|:---:|:--:|
396-
|<img src="images/hello_world_basic_android.png?raw=true" style="width:300px;" alt="Loading">|<img src="images/hello_world_basic_iOS.png?raw=true" style="width:300px;" alt="Loading">|
396+
|<img src="images/hello_world_basic_android.png?raw=true" style="width:300px;" alt="Loading">|<img src="images/hello_world_basic_iOS.png?raw=true" style="width:300px;" alt="Loading">|
397397

398398
<br>
399399
Now that you've seen the most basic Flutter app, the next section shows
400400
how to take advantage of Flutter's rich widget libraries to create a modern,
401401
polished app.
402402

403-
### How do I use widgets and nest them to form a widget tree?
403+
### How do I use widgets and nest them to form a widget tree?
404404

405405
In Flutter, almost everything is a widget.
406406

@@ -412,9 +412,9 @@ the root widget serves this role.
412412

413413
A widget can define:
414414

415-
* A structural element—like a button or menu
416-
* A stylistic element—like a font or color scheme
417-
* An aspect of layout—like padding or alignment
415+
* A structural element—like a button or menu
416+
* A stylistic element—like a font or color scheme
417+
* An aspect of layout—like padding or alignment
418418

419419
The following example shows the "Hello world!" app using widgets from the
420420
Material library. In this example, the widget tree is nested inside the
@@ -452,7 +452,7 @@ The following images show "Hello world!" built from Material Design widgets. You
452452

453453
|Android |iOS |
454454
|:---:|:--:|
455-
|<img src="images/6b18b6e158b15685.png?raw=true" style="width:275px;" alt="Loading">|<img src="images/2e973d40d6e82114.png?raw=true" style="width:300px;" alt="Loading">|
455+
|<img src="images/6b18b6e158b15685.png?raw=true" style="width:275px;" alt="Loading">|<img src="images/2e973d40d6e82114.png?raw=true" style="width:300px;" alt="Loading">|
456456

457457
<br>
458458

@@ -469,7 +469,7 @@ The important difference between stateless and stateful widgets is that
469469
In simple or basic apps it's easy to nest widgets, but as the code base gets
470470
larger and the app becomes complex, you should break deeply nested widgets into
471471
functions that return the widget or smaller classes. Creating separate functions
472-
and widgets allows you to reuse the components within the app.
472+
and widgets allows you to reuse the components within the app.
473473

474474
### How do I create reusable components?
475475

@@ -573,7 +573,7 @@ void main(){
573573
In Flutter, the entry point file is `’projectname’/lib/main.dart` and execution
574574
starts from the `main` function.
575575

576-
### How are files structured in a Flutter app?
576+
### How are files structured in a Flutter app?
577577

578578
When you create a new Flutter project, it builds the following directory structure. You can customize it later, but this is where you start.
579579
<pre>
@@ -600,8 +600,8 @@ When you create a new Flutter project, it builds the following directory structu
600600
A Flutter resource or asset is a file that is bundled and deployed with your app
601601
and is accessible at runtime. Flutter apps can include the following asset
602602
types:
603-
* Static data such as JSON files
604-
* Configuration files
603+
* Static data such as JSON files
604+
* Configuration files
605605
* Icons and images (JPEG, PNG, GIF, Animated GIF, WebP, Animated WebP, BMP,
606606
and WBMP)
607607

@@ -675,7 +675,7 @@ In Flutter, install a package using the following instructions:
675675

676676
1. Add the package name and version to the `pubspec.yaml` dependencies section.
677677
The example below shows how to add the `google_sign_in` Dart package to the
678-
`pubspec.yaml` file. Check your spaces when working in the YAML file because **white space matters**!
678+
`pubspec.yaml` file. Check your spaces when working in the YAML file because **white space matters**!
679679
<!-- skip -->
680680
```yaml
681681
dependencies:
@@ -1132,7 +1132,7 @@ internal state to manage.
11321132
describing does not depend on anything other than the configuration information
11331133
in the object itself and the [`BuildContext`](https://docs.flutter.io/flutter/widgets/BuildContext-class.html) in which the widget is inflated.
11341134

1135-
[AboutDialog](https://docs.flutter.io/flutter/material/AboutDialog-class.html), [CircleAvator](https://docs.flutter.io/flutter/material/CircleAvatar-class.html), and [Text](https://docs.flutter.io/flutter/widgets/Text-class.html) are examples of stateless widgets which subclass [StatelessWidget](https://docs.flutter.io/flutter/widgets/StatelessWidget-class.html).
1135+
[AboutDialog](https://docs.flutter.io/flutter/material/AboutDialog-class.html), [CircleAvatar](https://docs.flutter.io/flutter/material/CircleAvatar-class.html), and [Text](https://docs.flutter.io/flutter/widgets/Text-class.html) are examples of stateless widgets which subclass [StatelessWidget](https://docs.flutter.io/flutter/widgets/StatelessWidget-class.html).
11361136

11371137

11381138
<!-- skip -->
@@ -1601,9 +1601,9 @@ const MyApp = TabNavigator(
16011601
```
16021602

16031603
Flutter provides several specialized widgets for drawer and tab navigation:
1604-
* [TabController](https://docs.flutter.io/flutter/material/TabController-class.html)—Coordinates the tab selection between a TabBar and a TabBarView.
1605-
* [TabBar](https://docs.flutter.io/flutter/material/TabBar-class.html) —Displays a horizontal row of tabs.
1606-
* [Tab](https://docs.flutter.io/flutter/material/Tab-class.html)—Creates a material design TabBar tab.
1604+
* [TabController](https://docs.flutter.io/flutter/material/TabController-class.html)—Coordinates the tab selection between a TabBar and a TabBarView.
1605+
* [TabBar](https://docs.flutter.io/flutter/material/TabBar-class.html) —Displays a horizontal row of tabs.
1606+
* [Tab](https://docs.flutter.io/flutter/material/Tab-class.html)—Creates a material design TabBar tab.
16071607
* [TabBarView](https://docs.flutter.io/flutter/material/TabBarView-class.html)—Displays the widget that corresponds to the currently selected tab.
16081608

16091609

@@ -2159,7 +2159,7 @@ app.
21592159
In React Native, Animated APIs are used to create animations.
21602160

21612161
In Flutter, use the [`Animation`](https://docs.flutter.io/flutter/animation/Animation-class.html)
2162-
class and the [`AnimationController`](https://docs.flutter.io/flutter/animation/AnimationController-class.html) class.
2162+
class and the [`AnimationController`](https://docs.flutter.io/flutter/animation/AnimationController-class.html) class.
21632163
`Animation` is an abstract class that understands its current value and
21642164
its state (completed or dismissed). The `AnimationController` class lets you
21652165
play an animation forward or in reverse, or stop animation and set the animation
@@ -2305,13 +2305,14 @@ child: Dismissible(
23052305

23062306
|Android|iOS|
23072307
|:---:|:--:|
2308-
|<img src="images/card_swipe_android.gif?raw=true" style="width:300px;" alt="Loading">|<img src="images/card_swipe_iOS.gif?raw=true" style="width:300px;" alt="Loading">|
2308+
|<img src="images/card_swipe_android.gif?raw=true" style="width:300px;" alt="Loading">|<img src="images/card_swipe_iOS.gif?raw=true" style="width:300px;" alt="Loading">|
23092309

23102310
<br>
23112311

23122312
## React Native and Flutter Widget equivalent components
23132313

2314-
The following table lists commonly-used React Native components mapped to the corresponding Flutter widget and common widget properties.
2314+
The following table lists commonly-used React Native components mapped to the
2315+
corresponding Flutter widget and common widget properties.
23152316

23162317
| React Native Component | Flutter Widget | Description |
23172318
| ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |

src/get-started/codelab/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ a child inside the existing `MyApp` stateless widget.
326326
build method that generates the word pairs by moving the
327327
word generation code from `MyApp` to `RandomWordsState`.
328328
329-
3. Add the `build()` method to `RandomWordState`:
329+
3. Add the `build()` method to `RandomWordsState`:
330330
331331
<!-- skip -->
332332
{% prettify dart %}

0 commit comments

Comments
 (0)