Skip to content

Commit

Permalink
remove unnecessary new from samples (flutter#818)
Browse files Browse the repository at this point in the history
  • Loading branch information
a14n authored and mit-mit committed Oct 16, 2018
1 parent f1860c9 commit 00e294f
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 36 deletions.
12 changes: 6 additions & 6 deletions packages/cloud_firestore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ Binding a `CollectionReference` to a `ListView`:
class BookList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new StreamBuilder<QuerySnapshot>(
return StreamBuilder<QuerySnapshot>(
stream: Firestore.instance.collection('books').snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) return new Text('Loading...');
return new ListView(
if (!snapshot.hasData) return Text('Loading...');
return ListView(
children: snapshot.data.documents.map((DocumentSnapshot document) {
return new ListTile(
title: new Text(document['title']),
subtitle: new Text(document['author']),
return ListTile(
title: Text(document['title']),
subtitle: Text(document['author']),
);
}).toList(),
);
Expand Down
12 changes: 6 additions & 6 deletions packages/firebase_admob/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ FirebaseAdMob.instance.initialize(appId: appId);
```

## Using banners and interstitials
Banner and interstitial ads can be configured with target information.
Banner and interstitial ads can be configured with target information.
And in the example below, the ads are given test ad unit IDs for a quick start.

```
MobileAdTargetingInfo targetingInfo = new MobileAdTargetingInfo(
```dart
MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
keywords: <String>['flutterio', 'beautiful apps'],
contentUrl: 'https://flutter.io',
birthday: new DateTime.now(),
birthday: DateTime.now(),
childDirected: false,
designedForFamilies: false,
gender: MobileAdGender.male, // or MobileAdGender.female, MobileAdGender.unknown
testDevices: <String>[], // Android emulators are considered test devices
);
BannerAd myBanner = new BannerAd(
BannerAd myBanner = BannerAd(
// Replace the testAdUnitId with an ad unit id from the AdMob dash.
// https://developers.google.com/admob/android/test-ads
// https://developers.google.com/admob/ios/test-ads
Expand All @@ -42,7 +42,7 @@ BannerAd myBanner = new BannerAd(
},
);
InterstitialAd myInterstitial = new InterstitialAd(
InterstitialAd myInterstitial = InterstitialAd(
// Replace the testAdUnitId with an ad unit id from the AdMob dash.
// https://developers.google.com/admob/android/test-ads
// https://developers.google.com/admob/ios/test-ads
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_admob/lib/firebase_admob.dart
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ class RewardedVideoAd {
///
/// Apps can create, load, and show mobile ads. For example:
/// ```
/// BannerAd myBanner = new BannerAd(unitId: myBannerAdUnitId)
/// BannerAd myBanner = BannerAd(unitId: myBannerAdUnitId)
/// ..load()
/// ..show();
/// ```
Expand Down
6 changes: 3 additions & 3 deletions packages/firebase_analytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ To track `PageRoute` transitions, add a `FirebaseAnalyticsObserver` to the list

```dart
FirebaseAnalytics analytics = new FirebaseAnalytics();
FirebaseAnalytics analytics = FirebaseAnalytics();
MaterialApp(
home: new MyAppHome(),
home: MyAppHome(),
navigatorObservers: [
new FirebaseAnalyticsObserver(analytics: analytics),
FirebaseAnalyticsObserver(analytics: analytics),
],
);
```
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_analytics/lib/firebase_analytics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class FirebaseAnalytics {
///
/// Example:
///
/// FirebaseAnalytics analytics = new FirebaseAnalytics();
/// FirebaseAnalytics analytics = FirebaseAnalytics();
/// analytics.android?.setMinimumSessionDuration(200000);
final FirebaseAnalyticsAndroid android;

Expand Down
10 changes: 5 additions & 5 deletions packages/firebase_analytics/lib/observer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ String defaultNameExtractor(RouteSettings settings) => settings.name;
/// ```dart
/// Navigator.pushNamed(context, '/contact/123');
///
/// Navigator.push(context, new MaterialPageRoute(
/// settings: new RouteSettings(name: '/contact/123',
/// builder: new ContactDetail(123)))),
/// Navigator.push(context, MaterialPageRoute(
/// settings: RouteSettings(name: '/contact/123',
/// builder: ContactDetail(123)))),
///
/// Navigator.pop(context);
/// ```
Expand All @@ -38,9 +38,9 @@ String defaultNameExtractor(RouteSettings settings) => settings.name;
/// you're using a [MaterialApp]:
/// ```dart
/// MaterialApp(
/// home: new MyAppHome(),
/// home: MyAppHome(),
/// navigatorObservers: [
/// new FirebaseAnalyticsObserver(analytics: service.analytics),
/// FirebaseAnalyticsObserver(analytics: service.analytics),
/// ],
/// );
/// ```
Expand Down
20 changes: 10 additions & 10 deletions packages/firebase_dynamic_links/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@ https://example.page.link/WXYZ
You can create a Dynamic Link programmatically by setting the following parameters and using the `DynamicLinkParameters.buildUrl()` method.

```dart
final DynamicLinkParameters parameters = new DynamicLinkParameters(
final DynamicLinkParameters parameters = DynamicLinkParameters(
domain: 'abc123.app.goo.gl',
link: Uri.parse('https://example.com/'),
androidParameters: new AndroidParameters(
androidParameters: AndroidParameters(
packageName: 'com.example.android',
minimumVersion: 125,
),
iosParameters: new IosParameters(
iosParameters: IosParameters(
bundleId: 'com.example.ios',
minimumVersion: '1.0.1',
appStoreId: '123456789',
),
googleAnalyticsParameters: new GoogleAnalyticsParameters(
googleAnalyticsParameters: GoogleAnalyticsParameters(
campaign: 'example-promo',
medium: 'social',
source: 'orkut',
),
itunesConnectAnalyticsParameters: new ItunesConnectAnalyticsParameters(
itunesConnectAnalyticsParameters: ItunesConnectAnalyticsParameters(
providerToken: '123456',
campaignToken: 'example-promo',
),
socialMetaTagParameters: new SocialMetaTagParameters(
socialMetaTagParameters: SocialMetaTagParameters(
title: 'Example of a Dynamic Link',
description: 'This link works whether app is installed or not!',
),
Expand All @@ -71,7 +71,7 @@ To shorten a long Dynamic Link, use the DynamicLinkParameters.shortenUrl method.
```dart
final ShortDynamicLink shortenedLink = await DynamicLinkParameters.shortenUrl(
Uri.parse('https://example.page.link/?link=https://example.com/&apn=com.example.android&ibn=com.example.ios'),
new DynamicLinkParametersOptions(ShortDynamicLinkPathLength.unguessable),
DynamicLinkParametersOptions(ShortDynamicLinkPathLength.unguessable),
);
final Uri shortUrl = shortenedLink.shortUrl;
Expand Down Expand Up @@ -101,11 +101,11 @@ applinks:YOUR_SUBDOMAIN.page.link

```dart
void main() {
runApp(new MaterialApp(
runApp(MaterialApp(
title: 'Dynamic Links Example',
routes: <String, WidgetBuilder>{
'/': (BuildContext context) => new MyHomeWidget(), // Default home route
'/helloworld': (BuildContext context) => new MyHelloWorldWidget(),
'/': (BuildContext context) => MyHomeWidget(), // Default home route
'/helloworld': (BuildContext context) => MyHelloWorldWidget(),
},
));
}
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_messaging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ From your Dart code, you need to import the plugin and instantiate it:
```dart
import 'package:firebase_messaging/firebase_messaging.dart';

final FirebaseMessaging _firebaseMessaging = new FirebaseMessaging();
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
```

Next, you should probably request permissions for receiving Push Notifications. For this, call `_firebaseMessaging.requestNotificationPermissions()`. This will bring up a permissions dialog for the user to confirm on iOS. It's a no-op on Android. Last, but not least, register `onMessage`, `onResume`, and `onLaunch` callbacks via `_firebaseMessaging.configure()` to listen for incoming messages (see table below for more information).
Expand Down
5 changes: 2 additions & 3 deletions packages/firebase_performance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ class _MyAppState extends State<MyApp> {
.
.
Future<void> testHttpMetric() async {
final _MetricHttpClient metricHttpClient =
new _MetricHttpClient(new Client());
final _MetricHttpClient metricHttpClient = _MetricHttpClient(Client());
final Request request =
new Request("SEND", Uri.parse("https://www.google.com"));
Request("SEND", Uri.parse("https://www.google.com"));
metricHttpClient.send(request);
}
Expand Down

0 comments on commit 00e294f

Please sign in to comment.