diff --git a/packages/android_alarm_manager/README.md b/packages/android_alarm_manager/README.md index cb8e76c5b3a3..740a1848da97 100644 --- a/packages/android_alarm_manager/README.md +++ b/packages/android_alarm_manager/README.md @@ -22,7 +22,7 @@ Then in Dart code add: import 'package:android_alarm_manager/android_alarm_manager.dart'; void printHello() { - final DateTime now = new DateTime.now(); + final DateTime now = DateTime.now(); final int isolateId = Isolate.current.hashCode; print("[$now] Hello, world! isolate=${isolateId} function='$printHello'"); } diff --git a/packages/android_intent/README.md b/packages/android_intent/README.md index 144ffbbb8f3f..37278707e4b1 100644 --- a/packages/android_intent/README.md +++ b/packages/android_intent/README.md @@ -7,9 +7,9 @@ mode, we assert that the platform should be Android. Use it by specifying action, category, data and extra arguments for the intent. It does not support returning the result of the launched activity. Sample usage: -``` +```dart if (platform.isAndroid) { - AndroidIntent intent = new AndroidIntent( + AndroidIntent intent = AndroidIntent( action: 'action_view', data: 'https://play.google.com/store/apps/details?' 'id=com.google.android.apps.myapp', diff --git a/packages/battery/README.md b/packages/battery/README.md index c9cdfb4278d0..2ed23eea3259 100644 --- a/packages/battery/README.md +++ b/packages/battery/README.md @@ -14,7 +14,7 @@ To use this plugin, add `battery` as a [dependency in your pubspec.yaml file](ht import 'package:battery/battery.dart'; // Instantiate it -var battery = new Battery(); +var battery = Battery(); // Access current battery level print(battery.batteryLevel); diff --git a/packages/camera/README.md b/packages/camera/README.md index 6cecd11d7393..7d10149c7628 100644 --- a/packages/camera/README.md +++ b/packages/camera/README.md @@ -50,12 +50,12 @@ List cameras; Future main() async { cameras = await availableCameras(); - runApp(new CameraApp()); + runApp(CameraApp()); } class CameraApp extends StatefulWidget { @override - _CameraAppState createState() => new _CameraAppState(); + _CameraAppState createState() => _CameraAppState(); } class _CameraAppState extends State { @@ -64,7 +64,7 @@ class _CameraAppState extends State { @override void initState() { super.initState(); - controller = new CameraController(cameras[0], ResolutionPreset.medium); + controller = CameraController(cameras[0], ResolutionPreset.medium); controller.initialize().then((_) { if (!mounted) { return; @@ -82,12 +82,12 @@ class _CameraAppState extends State { @override Widget build(BuildContext context) { if (!controller.value.isInitialized) { - return new Container(); + return Container(); } - return new AspectRatio( + return AspectRatio( aspectRatio: controller.value.aspectRatio, - child: new CameraPreview(controller)); + child: CameraPreview(controller)); } } ``` diff --git a/packages/cloud_firestore/README.md b/packages/cloud_firestore/README.md index acf3aa6350b0..379a5a820924 100755 --- a/packages/cloud_firestore/README.md +++ b/packages/cloud_firestore/README.md @@ -44,15 +44,15 @@ Binding a `CollectionReference` to a `ListView`: class BookList extends StatelessWidget { @override Widget build(BuildContext context) { - return new StreamBuilder( + return StreamBuilder( stream: Firestore.instance.collection('books').snapshots(), builder: (BuildContext context, AsyncSnapshot 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(), ); diff --git a/packages/connectivity/README.md b/packages/connectivity/README.md index f6a9807d72db..de1cbea25a97 100644 --- a/packages/connectivity/README.md +++ b/packages/connectivity/README.md @@ -12,7 +12,7 @@ Sample usage to check current status: ```dart import 'package:connectivity/connectivity.dart'; -var connectivityResult = await (new Connectivity().checkConnectivity()); +var connectivityResult = await (Connectivity().checkConnectivity()); if (connectivityResult == ConnectivityResult.mobile) { // I am connected to a mobile network. } else if (connectivityResult == ConnectivityResult.wifi) { @@ -31,7 +31,7 @@ exposed by connectivity plugin: import 'package:connectivity/connectivity.dart'; initState() { - subscription = new Connectivity().onConnectivityChanged.listen((ConnectivityResult result) { + subscription = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) { // Got a new connectivity status! }) } diff --git a/packages/device_info/README.md b/packages/device_info/README.md index 8ccbeb525889..128bea5c2a17 100644 --- a/packages/device_info/README.md +++ b/packages/device_info/README.md @@ -13,7 +13,7 @@ Example: ```dart import 'package:device_info/device_info.dart'; -DeviceInfoPlugin deviceInfo = new DeviceInfoPlugin(); +DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; print('Running on ${androidInfo.model}'); // e.g. "Moto G (4)" diff --git a/packages/firebase_admob/README.md b/packages/firebase_admob/README.md index cb3bfb65d418..662f934076af 100644 --- a/packages/firebase_admob/README.md +++ b/packages/firebase_admob/README.md @@ -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: ['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: [], // 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 @@ -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 diff --git a/packages/firebase_admob/lib/firebase_admob.dart b/packages/firebase_admob/lib/firebase_admob.dart index 4f0c278ee145..e2f0972b7b30 100644 --- a/packages/firebase_admob/lib/firebase_admob.dart +++ b/packages/firebase_admob/lib/firebase_admob.dart @@ -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(); /// ``` diff --git a/packages/firebase_analytics/README.md b/packages/firebase_analytics/README.md index f4528b1206dd..41f3f01403c9 100755 --- a/packages/firebase_analytics/README.md +++ b/packages/firebase_analytics/README.md @@ -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), ], ); ``` diff --git a/packages/firebase_analytics/lib/firebase_analytics.dart b/packages/firebase_analytics/lib/firebase_analytics.dart index 80115240001a..d693af448453 100755 --- a/packages/firebase_analytics/lib/firebase_analytics.dart +++ b/packages/firebase_analytics/lib/firebase_analytics.dart @@ -36,7 +36,7 @@ class FirebaseAnalytics { /// /// Example: /// - /// FirebaseAnalytics analytics = new FirebaseAnalytics(); + /// FirebaseAnalytics analytics = FirebaseAnalytics(); /// analytics.android?.setMinimumSessionDuration(200000); final FirebaseAnalyticsAndroid android; diff --git a/packages/firebase_analytics/lib/observer.dart b/packages/firebase_analytics/lib/observer.dart index 51ab7022da2b..1bbb9ed5ba03 100644 --- a/packages/firebase_analytics/lib/observer.dart +++ b/packages/firebase_analytics/lib/observer.dart @@ -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); /// ``` @@ -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), /// ], /// ); /// ``` diff --git a/packages/firebase_dynamic_links/README.md b/packages/firebase_dynamic_links/README.md index 56f62afed5fb..423a8133fd97 100644 --- a/packages/firebase_dynamic_links/README.md +++ b/packages/firebase_dynamic_links/README.md @@ -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!', ), @@ -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; @@ -101,11 +101,11 @@ applinks:YOUR_SUBDOMAIN.page.link ```dart void main() { - runApp(new MaterialApp( + runApp(MaterialApp( title: 'Dynamic Links Example', routes: { - '/': (BuildContext context) => new MyHomeWidget(), // Default home route - '/helloworld': (BuildContext context) => new MyHelloWorldWidget(), + '/': (BuildContext context) => MyHomeWidget(), // Default home route + '/helloworld': (BuildContext context) => MyHelloWorldWidget(), }, )); } diff --git a/packages/firebase_messaging/README.md b/packages/firebase_messaging/README.md index 0ff91ef58dab..9952edb3a9b4 100644 --- a/packages/firebase_messaging/README.md +++ b/packages/firebase_messaging/README.md @@ -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). diff --git a/packages/firebase_performance/README.md b/packages/firebase_performance/README.md index 1563ac79e532..961c7f017623 100644 --- a/packages/firebase_performance/README.md +++ b/packages/firebase_performance/README.md @@ -70,11 +70,10 @@ class _MyAppState extends State { . . Future 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); } diff --git a/packages/google_maps_flutter/README.md b/packages/google_maps_flutter/README.md index 1e1f1c1b86e4..315a7e28fbc4 100644 --- a/packages/google_maps_flutter/README.md +++ b/packages/google_maps_flutter/README.md @@ -50,7 +50,7 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; void main() { runApp(MaterialApp( - home: new Scaffold( + home: Scaffold( appBar: AppBar(title: const Text('Google Maps demo')), body: MapsDemo(), ), diff --git a/packages/google_sign_in/README.md b/packages/google_sign_in/README.md index a83dd7540b46..64268008a9ee 100755 --- a/packages/google_sign_in/README.md +++ b/packages/google_sign_in/README.md @@ -23,8 +23,8 @@ enable the [Google People API](https://developers.google.com/people/). 1. [First register your application](https://developers.google.com/mobile/add?platform=ios). 2. Open Xcode. You'll have to paste this into Xcode to properly register `GoogleServices-Info.plist`. 3. Select `GoogleServices-Info.plist` from the file manager and drag that file into the `Runner` directory, `[my_project]/ios/Runner/GoogleServices-Info.plist`. -4. A dialog will show up and ask you to select the targets, select the `Runner` target. -5. Then add the `CFBundleURLTypes` attributes below into the `[my_project]/ios/Runner/Info.plist` file. +4. A dialog will show up and ask you to select the targets, select the `Runner` target. +5. Then add the `CFBundleURLTypes` attributes below into the `[my_project]/ios/Runner/Info.plist` file. ``` @@ -59,8 +59,8 @@ import 'package:google_sign_in/google_sign_in.dart'; Initialize GoogleSignIn with the scopes you want: -``` -GoogleSignIn _googleSignIn = new GoogleSignIn( +```dart +GoogleSignIn _googleSignIn = GoogleSignIn( scopes: [ 'email', 'https://www.googleapis.com/auth/contacts.readonly', diff --git a/packages/google_sign_in/lib/testing.dart b/packages/google_sign_in/lib/testing.dart index 51c1b4a227d7..79379557604e 100644 --- a/packages/google_sign_in/lib/testing.dart +++ b/packages/google_sign_in/lib/testing.dart @@ -15,9 +15,9 @@ import 'package:flutter/services.dart' show MethodCall; /// FakeSignInBackend fakeSignInBackend; /// /// setUp(() { -/// googleSignIn = new GoogleSignIn(); -/// fakeSignInBackend = new FakeSignInBackend(); -/// fakeSignInBackend.user = new FakeUser( +/// googleSignIn = GoogleSignIn(); +/// fakeSignInBackend = FakeSignInBackend(); +/// fakeSignInBackend.user = FakeUser( /// id: 123, /// email: 'jdoe@example.org', /// ); diff --git a/packages/image_picker/README.md b/packages/image_picker/README.md index 7c287fe2169f..32cd88ef21c1 100755 --- a/packages/image_picker/README.md +++ b/packages/image_picker/README.md @@ -30,7 +30,7 @@ import 'package:image_picker/image_picker.dart'; class MyHomePage extends StatefulWidget { @override - _MyHomePageState createState() => new _MyHomePageState(); + _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State { @@ -46,19 +46,19 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { - return new Scaffold( - appBar: new AppBar( - title: new Text('Image Picker Example'), + return Scaffold( + appBar: AppBar( + title: Text('Image Picker Example'), ), - body: new Center( + body: Center( child: _image == null - ? new Text('No image selected.') - : new Image.file(_image), + ? Text('No image selected.') + : Image.file(_image), ), - floatingActionButton: new FloatingActionButton( + floatingActionButton: FloatingActionButton( onPressed: getImage, tooltip: 'Pick Image', - child: new Icon(Icons.add_a_photo), + child: Icon(Icons.add_a_photo), ), ); } diff --git a/packages/local_auth/README.md b/packages/local_auth/README.md index e0fc9a8767b6..14c40589cca0 100644 --- a/packages/local_auth/README.md +++ b/packages/local_auth/README.md @@ -29,7 +29,7 @@ instructions will pop up to let the user set up fingerprint. If the user clicks Use the exported APIs to trigger local authentication with default dialogs: ```dart -var localAuth = new LocalAuthentication(); +var localAuth = LocalAuthentication(); bool didAuthenticate = await localAuth.authenticateWithBiometrics( localizedReason: 'Please authenticate to show account balance'); diff --git a/packages/quick_actions/README.md b/packages/quick_actions/README.md index 3ece265a5179..30d91bf1cb73 100644 --- a/packages/quick_actions/README.md +++ b/packages/quick_actions/README.md @@ -29,8 +29,8 @@ Finally, manage the app's quick actions, for instance: ```dart quickActions.setShortcutItems([ - new quickActions.ShortcutItem(type: 'action_main', localizedTitle: 'Main view', icon: 'icon_main'), - new quickActions.ShortcutItem(type: 'action_help', localizedTitle: 'Help', icon: 'icon_help') + quickActions.ShortcutItem(type: 'action_main', localizedTitle: 'Main view', icon: 'icon_main'), + quickActions.ShortcutItem(type: 'action_help', localizedTitle: 'Help', icon: 'icon_help') ]); ``` diff --git a/packages/shared_preferences/README.md b/packages/shared_preferences/README.md index 726fc37a8c4a..5153945bcd09 100644 --- a/packages/shared_preferences/README.md +++ b/packages/shared_preferences/README.md @@ -17,12 +17,12 @@ import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; void main() { - runApp(new MaterialApp( - home: new Scaffold( - body: new Center( - child: new RaisedButton( + runApp(MaterialApp( + home: Scaffold( + body: Center( + child: RaisedButton( onPressed: _incrementCounter, - child: new Text('Increment Counter'), + child: Text('Increment Counter'), ), ), ), diff --git a/packages/url_launcher/README.md b/packages/url_launcher/README.md index 37ed530dbf2e..8867857dc93b 100644 --- a/packages/url_launcher/README.md +++ b/packages/url_launcher/README.md @@ -14,11 +14,11 @@ import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; void main() { - runApp(new Scaffold( - body: new Center( - child: new RaisedButton( + runApp(Scaffold( + body: Center( + child: RaisedButton( onPressed: _launchURL, - child: new Text('Show Flutter homepage'), + child: Text('Show Flutter homepage'), ), ), ));