diff --git a/packages/android_alarm_manager_plus/README.md b/packages/android_alarm_manager_plus/README.md index f26975944f..33311e2ece 100644 --- a/packages/android_alarm_manager_plus/README.md +++ b/packages/android_alarm_manager_plus/README.md @@ -113,6 +113,8 @@ This intent has the action `android.intent.action.MAIN` and includes the followi Setting the alarm: ```dart +import 'package:android_alarm_manager_plus/android_alarm_manager_plus.dart'; + await AndroidAlarmManager.oneShotAt( time, id, diff --git a/packages/android_intent_plus/README.md b/packages/android_intent_plus/README.md index 4dc7a1ef05..3b28a936c9 100644 --- a/packages/android_intent_plus/README.md +++ b/packages/android_intent_plus/README.md @@ -88,6 +88,8 @@ of integers or strings. or get the details of the activity that can handle the intent. ```dart +import 'package:android_intent_plus/android_intent.dart'; + final intent = AndroidIntent( action: 'action_view', data: Uri.encodeFull('http://'), diff --git a/packages/connectivity_plus/connectivity_plus/README.md b/packages/connectivity_plus/connectivity_plus/README.md index 644b63f8c9..b0f050f926 100644 --- a/packages/connectivity_plus/connectivity_plus/README.md +++ b/packages/connectivity_plus/connectivity_plus/README.md @@ -71,21 +71,31 @@ This method should ensure emitting only distinct values. ```dart import 'package:connectivity_plus/connectivity_plus.dart'; +import 'dart:async'; -@override -initState() { - super.initState(); - - StreamSubscription> subscription = Connectivity().onConnectivityChanged.listen((List result) { - // Received changes in available connectivity types! - }); +class MyWidget extends StatefulWidget { + @override + _MyWidgetState createState() => _MyWidgetState(); } -// Be sure to cancel subscription after you are done -@override -dispose() { - subscription.cancel(); - super.dispose(); +class _MyWidgetState extends State { + StreamSubscription>? subscription; + + @override + void initState() { + super.initState(); + + subscription = Connectivity().onConnectivityChanged.listen((List result) { + // Received changes in available connectivity types! + }); + } + + // Be sure to cancel subscription after you are done + @override + void dispose() { + subscription?.cancel(); + super.dispose(); + } } ``` diff --git a/packages/sensors_plus/sensors_plus/README.md b/packages/sensors_plus/sensors_plus/README.md index 13b5066022..950e2ac5d3 100644 --- a/packages/sensors_plus/sensors_plus/README.md +++ b/packages/sensors_plus/sensors_plus/README.md @@ -153,6 +153,8 @@ Alternatively, every stream allows to specify the sampling rate for its sensor u ```dart +import 'package:sensors_plus/sensors_plus.dart'; + magnetometerEvents(samplingPeriod: SensorInterval.normalInterval).listen( (MagnetometerEvent event) { print(event); diff --git a/packages/share_plus/share_plus/README.md b/packages/share_plus/share_plus/README.md index 6984ae9e2b..41db312a1b 100644 --- a/packages/share_plus/share_plus/README.md +++ b/packages/share_plus/share_plus/README.md @@ -51,6 +51,8 @@ Access the `SharePlus` instance via `SharePlus.instance`. Then, invoke the `share()` method anywhere in your Dart code. ```dart +import 'package:share_plus/share_plus.dart'; + SharePlus.instance.share( ShareParams(text: 'check out my website https://example.com') ); @@ -83,6 +85,9 @@ To share one or multiple files, provide the `files` list in `ShareParams`. Optionally, you can pass `title`, `text` and `sharePositionOrigin`. ```dart +import 'package:share_plus/share_plus.dart'; +import 'package:cross_file/cross_file.dart'; + final params = ShareParams( text: 'Great picture', files: [XFile('${directory.path}/image.jpg')], @@ -96,6 +101,9 @@ if (result.status == ShareResultStatus.success) { ``` ```dart +import 'package:share_plus/share_plus.dart'; +import 'package:cross_file/cross_file.dart'; + final params = ShareParams( files: [ XFile('${directory.path}/image1.jpg'), @@ -119,6 +127,8 @@ package. File downloading fallback mechanism for web can be disabled by setting: ```dart +import 'package:share_plus/share_plus.dart'; + ShareParams( // rest of params downloadFallbackEnabled: false, @@ -132,6 +142,10 @@ You can also share files that you dynamically generate from its data using [`XFi To set the name of such files, use the `fileNameOverrides` parameter, otherwise the file name will be a random UUID string. ```dart +import 'package:share_plus/share_plus.dart'; +import 'package:cross_file/cross_file.dart'; +import 'dart:convert'; + final params = ShareParams( files: [XFile.fromData(utf8.encode(text), mimeType: 'text/plain')], fileNameOverrides: ['myfile.txt'] @@ -150,6 +164,8 @@ This special functionality is only properly supported on iOS. On other platforms, the URI will be shared as plain text. ```dart +import 'package:share_plus/share_plus.dart'; + final params = ShareParams(uri: uri); SharePlus.instance.share(params); @@ -233,7 +249,7 @@ or search for other Flutter plugins implementing this SDK. More information can Other apps may also give problems when attempting to share content to them. This is because 3rd party app developers do not properly implement the logic to receive share actions. -We cannot warranty that a 3rd party app will properly implement the share functionality. +We cannot guarantee that a 3rd party app will properly implement the share functionality. Therefore, **all bugs reported regarding compatibility with a specific app will be closed.** #### Localization in Apple platforms @@ -249,7 +265,7 @@ For more information check the [CoreFoundationKeys](https://developer.apple.com/ `share_plus` requires iPad users to provide the `sharePositionOrigin` parameter. Without it, `share_plus` will not work on iPads and may cause a crash or -letting the UI not responding. +leave the UI unresponsive. To avoid that problem, provide the `sharePositionOrigin`. @@ -292,6 +308,8 @@ To convert code using `Share.share()` to the new `SharePlus` class: e.g. ```dart +import 'package:share/share.dart'; + Share.share("Shared text"); Share.shareUri("http://example.com"); @@ -302,6 +320,8 @@ Share.shareXFiles(files); Becomes: ```dart +import 'package:share_plus/share_plus.dart'; + SharePlus.instance.share( ShareParams(text: "Shared text"), );