diff --git a/.ci/flutter_master.version b/.ci/flutter_master.version index 8e787561c54f..57aa139ea7ed 100644 --- a/.ci/flutter_master.version +++ b/.ci/flutter_master.version @@ -1 +1 @@ -707dbc0420a34d327476bc12fac5aa2e22978a2e +23f6f5853f50c4ee200d9f6aa0f1015b36e70e3c diff --git a/packages/camera/camera/README.md b/packages/camera/camera/README.md index f3fbdc35a738..0a39b9a7478f 100644 --- a/packages/camera/camera/README.md +++ b/packages/camera/camera/README.md @@ -71,6 +71,7 @@ void didChangeAppLifecycleState(AppLifecycleState state) { _initializeCameraController(cameraController.description); } } + ``` ### Handling camera access permissions diff --git a/packages/camera/camera/example/lib/main.dart b/packages/camera/camera/example/lib/main.dart index cca528c04fda..cbbbf242c086 100644 --- a/packages/camera/camera/example/lib/main.dart +++ b/packages/camera/camera/example/lib/main.dart @@ -127,6 +127,7 @@ class _CameraExampleHomeState extends State _initializeCameraController(cameraController.description); } } + // #enddocregion AppLifecycle @override diff --git a/packages/camera/camera_android_camerax/example/lib/main.dart b/packages/camera/camera_android_camerax/example/lib/main.dart index c3aba39ed60f..b108b9a6e77c 100644 --- a/packages/camera/camera_android_camerax/example/lib/main.dart +++ b/packages/camera/camera_android_camerax/example/lib/main.dart @@ -126,6 +126,7 @@ class _CameraExampleHomeState extends State _initializeCameraController(cameraController.description); } } + // #enddocregion AppLifecycle @override diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart index 7b642695e0b0..dca2b8d08f80 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart @@ -5155,14 +5155,13 @@ class ImageCapture extends UseCase { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [ - pigeonVar_instanceIdentifier, - resolutionSelector, - targetRotation, - flashMode, - ], - ); + final Future pigeonVar_sendFuture = pigeonVar_channel + .send([ + pigeonVar_instanceIdentifier, + resolutionSelector, + targetRotation, + flashMode, + ]); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { diff --git a/packages/extension_google_sign_in_as_googleapis_auth/README.md b/packages/extension_google_sign_in_as_googleapis_auth/README.md index 66c9562e388c..ec28a2dc9c5e 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/README.md +++ b/packages/extension_google_sign_in_as_googleapis_auth/README.md @@ -20,6 +20,7 @@ That object can then be used to create instances of `googleapis` API clients: ```dart import 'package:googleapis_auth/googleapis_auth.dart' as auth show AuthClient; + // ··· // Retrieve an [auth.AuthClient] from a GoogleSignInClientAuthorization. final auth.AuthClient client = authorization.authClient(scopes: scopes); diff --git a/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart b/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart index c857a070288a..79e1a24423ce 100644 --- a/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart +++ b/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart @@ -12,6 +12,7 @@ import 'package:google_sign_in/google_sign_in.dart'; import 'package:googleapis/people/v1.dart'; // #docregion CreateAPIClient import 'package:googleapis_auth/googleapis_auth.dart' as auth show AuthClient; + // #enddocregion CreateAPIClient /// The scopes used by this example. diff --git a/packages/go_router/doc/configuration.md b/packages/go_router/doc/configuration.md index 6f56b5959e2b..085cd90987ec 100644 --- a/packages/go_router/doc/configuration.md +++ b/packages/go_router/doc/configuration.md @@ -249,6 +249,7 @@ Widget build(BuildContext context) { ), ); } + ``` For a complete example, see the [Stateful Nested diff --git a/packages/go_router/example/lib/stateful_shell_route.dart b/packages/go_router/example/lib/stateful_shell_route.dart index 39e14ad53c35..455d6f4f2565 100644 --- a/packages/go_router/example/lib/stateful_shell_route.dart +++ b/packages/go_router/example/lib/stateful_shell_route.dart @@ -170,6 +170,7 @@ class ScaffoldWithNavBar extends StatelessWidget { ), ); } + // #enddocregion configuration-custom-shell /// NOTE: For a slightly more sophisticated branch switching, change the onTap diff --git a/packages/go_router_builder/README.md b/packages/go_router_builder/README.md index a2e69c018e55..99d298a489d4 100644 --- a/packages/go_router_builder/README.md +++ b/packages/go_router_builder/README.md @@ -28,6 +28,7 @@ generated file will always have the name `[source_file].g.dart`. import 'package:go_router/go_router.dart'; part 'readme_excerpts.g.dart'; + ``` ### Running `build_runner` @@ -95,6 +96,7 @@ class HomeRoute extends GoRouteData with $HomeRoute { @override Widget build(BuildContext context, GoRouterState state) => const HomeScreen(); } + ``` ## Route tree @@ -116,6 +118,7 @@ class HomeRoute extends GoRouteData with $HomeRoute { Widget build(BuildContext context, GoRouterState state) => const HomeScreen(); } + class RedirectRoute extends GoRouteData { // There is no need to implement [build] when this [redirect] is unconditional. @override @@ -124,6 +127,7 @@ class RedirectRoute extends GoRouteData { } } + @TypedGoRoute(path: '/login') class LoginRoute extends GoRouteData with $LoginRoute { LoginRoute({this.from}); @@ -134,6 +138,7 @@ class LoginRoute extends GoRouteData with $LoginRoute { return LoginScreen(from: from); } } + ``` ## `GoRouter` initialization @@ -161,6 +166,7 @@ class ErrorRoute extends GoRouteData { return ErrorScreen(error: error); } } + ``` With this in place, you can provide the `errorBuilder` parameter like so: @@ -222,6 +228,7 @@ class LoginRoute extends GoRouteData with $LoginRoute { return LoginScreen(from: from); } } + ``` ### Default values @@ -240,6 +247,7 @@ class MyRoute extends GoRouteData with $MyRoute { return MyScreen(queryParameter: queryParameter); } } + ``` A query parameter that equals to its default value is not included in the location. @@ -261,6 +269,7 @@ class PersonRouteWithExtra extends GoRouteData with $PersonRouteWithExtra { return PersonScreen($extra); } } + ``` Pass the extra param as a typed object: @@ -270,6 +279,7 @@ Pass the extra param as a typed object: void tapWithExtra() { PersonRouteWithExtra(Person(id: 1, name: 'Marvin', age: 42)).go(context); } + ``` The `$extra` parameter is still passed outside the location, still defeats @@ -295,6 +305,7 @@ class HotdogRouteWithEverything extends GoRouteData return HotdogScreen(ketchup, mustard, $extra); } } + ``` This seems kinda silly, but it works. @@ -332,6 +343,7 @@ class RedirectRoute extends GoRouteData { return const HomeRoute().location; } } + ``` ## Type conversions @@ -353,6 +365,7 @@ class BooksRoute extends GoRouteData with $BooksRoute { return BooksScreen(kind: kind); } } + ``` ## Transitions @@ -381,6 +394,7 @@ class MyMaterialRouteWithKey extends GoRouteData with $MyMaterialRouteWithKey { return const MaterialPage(key: _key, child: MyPage()); } } + ``` ### Custom transitions @@ -411,6 +425,7 @@ class FancyRoute extends GoRouteData with $FancyRoute { ); } } + ``` ## TypedShellRoute and navigator keys @@ -474,6 +489,7 @@ class DetailsRoute extends RelativeGoRouteData with $DetailsRoute { Widget build(BuildContext context, GoRouterState state) => const DetailsScreen(); } + ``` Navigate using the `goRelative` or `pushRelative` methods provided by the code generator: diff --git a/packages/go_router_builder/example/lib/readme_excerpts.dart b/packages/go_router_builder/example/lib/readme_excerpts.dart index 97c74ed3f503..780bae72de11 100644 --- a/packages/go_router_builder/example/lib/readme_excerpts.dart +++ b/packages/go_router_builder/example/lib/readme_excerpts.dart @@ -10,6 +10,7 @@ import 'shared/data.dart'; import 'package:go_router/go_router.dart'; part 'readme_excerpts.g.dart'; + // #enddocregion import void otherDoc(BuildContext context) { @@ -55,6 +56,7 @@ void otherDoc(BuildContext context) { void tapWithExtra() { PersonRouteWithExtra(Person(id: 1, name: 'Marvin', age: 42)).go(context); } + // #enddocregion tapWithExtra // #docregion goRelative @@ -95,6 +97,7 @@ class HomeRoute extends GoRouteData with $HomeRoute { @override Widget build(BuildContext context, GoRouterState state) => const HomeScreen(); } + // #enddocregion HomeRoute // #docregion RedirectRoute @@ -105,6 +108,7 @@ class RedirectRoute extends GoRouteData { return const HomeRoute().location; } } + // #enddocregion RedirectRoute // #docregion login @@ -118,6 +122,7 @@ class LoginRoute extends GoRouteData with $LoginRoute { return LoginScreen(from: from); } } + // #enddocregion login // #enddocregion TypedGoRouteHomeRoute @@ -183,6 +188,7 @@ class ErrorRoute extends GoRouteData { return ErrorScreen(error: error); } } + // #enddocregion ErrorRoute class ErrorScreen extends StatelessWidget { @@ -220,6 +226,7 @@ class MyRoute extends GoRouteData with $MyRoute { return MyScreen(queryParameter: queryParameter); } } + // #enddocregion MyRoute class MyScreen extends StatelessWidget { @@ -243,6 +250,7 @@ class PersonRouteWithExtra extends GoRouteData with $PersonRouteWithExtra { return PersonScreen($extra); } } + // #enddocregion PersonRouteWithExtra class PersonScreen extends StatelessWidget { @@ -269,6 +277,7 @@ class HotdogRouteWithEverything extends GoRouteData return HotdogScreen(ketchup, mustard, $extra); } } + // #enddocregion HotdogRouteWithEverything class Sauce {} @@ -298,6 +307,7 @@ class BooksRoute extends GoRouteData with $BooksRoute { return BooksScreen(kind: kind); } } + // #enddocregion BookKind class BooksScreen extends StatelessWidget { @@ -320,6 +330,7 @@ class MyMaterialRouteWithKey extends GoRouteData with $MyMaterialRouteWithKey { return const MaterialPage(key: _key, child: MyPage()); } } + // #enddocregion MyMaterialRouteWithKey class MyPage extends StatelessWidget { @@ -368,6 +379,7 @@ class FancyRoute extends GoRouteData with $FancyRoute { ); } } + // #enddocregion FancyRoute // #docregion MyShellRouteData @@ -411,6 +423,7 @@ class DetailsRoute extends RelativeGoRouteData with $DetailsRoute { Widget build(BuildContext context, GoRouterState state) => const DetailsScreen(); } + // #enddocregion relativeRoute class DetailsScreen extends StatelessWidget { diff --git a/packages/google_adsense/doc/h5.md b/packages/google_adsense/doc/h5.md index 93295ac21c1e..0dc28faf8fed 100644 --- a/packages/google_adsense/doc/h5.md +++ b/packages/google_adsense/doc/h5.md @@ -42,6 +42,7 @@ topic). ```dart import 'package:google_adsense/h5.dart'; + ``` This provides an `h5GamesAds` object with two methods: `adBreak` to request ads, diff --git a/packages/google_adsense/doc/initialization.md b/packages/google_adsense/doc/initialization.md index 8b1b777b3022..d1870a57e287 100644 --- a/packages/google_adsense/doc/initialization.md +++ b/packages/google_adsense/doc/initialization.md @@ -30,6 +30,7 @@ void main() async { runApp(const MyApp()); } + ``` ## Configure additional AdSense code parameters diff --git a/packages/google_adsense/example/lib/h5.dart b/packages/google_adsense/example/lib/h5.dart index fe2cab820eda..98d2ddeab9ca 100644 --- a/packages/google_adsense/example/lib/h5.dart +++ b/packages/google_adsense/example/lib/h5.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; import 'package:google_adsense/google_adsense.dart'; // #docregion import-h5 import 'package:google_adsense/h5.dart'; + // #enddocregion import-h5 void main() async { diff --git a/packages/google_adsense/example/lib/main.dart b/packages/google_adsense/example/lib/main.dart index 413190058f48..974c6ea54035 100644 --- a/packages/google_adsense/example/lib/main.dart +++ b/packages/google_adsense/example/lib/main.dart @@ -17,6 +17,7 @@ void main() async { runApp(const MyApp()); } + // #enddocregion init /// The main app. diff --git a/packages/google_fonts/README.md b/packages/google_fonts/README.md index c215d65dab1d..6ac5ceebc10b 100644 --- a/packages/google_fonts/README.md +++ b/packages/google_fonts/README.md @@ -100,6 +100,7 @@ ThemeData _buildTheme(Brightness brightness) { textTheme: GoogleFonts.latoTextTheme(baseTheme.textTheme), ); } + ``` Or, if you want a `TextTheme` where a couple of styles should use a different font: diff --git a/packages/google_fonts/example/lib/readme_excerpts.dart b/packages/google_fonts/example/lib/readme_excerpts.dart index 9d7189826719..8574e083dd60 100644 --- a/packages/google_fonts/example/lib/readme_excerpts.dart +++ b/packages/google_fonts/example/lib/readme_excerpts.dart @@ -92,6 +92,7 @@ ThemeData _buildTheme(Brightness brightness) { textTheme: GoogleFonts.latoTextTheme(baseTheme.textTheme), ); } + // #enddocregion AppThemeSimple /// Multi-font app theme example. diff --git a/packages/google_identity_services_web/README.md b/packages/google_identity_services_web/README.md index f5a087f31550..9cf624ce4b3e 100644 --- a/packages/google_identity_services_web/README.md +++ b/packages/google_identity_services_web/README.md @@ -50,6 +50,7 @@ void main() async { // The rest of your code... // ··· } + ``` (Note that the above won't compile for mobile apps, so if you're developing a diff --git a/packages/google_identity_services_web/example/lib/main.dart b/packages/google_identity_services_web/example/lib/main.dart index b12980289658..b84c075b53a7 100644 --- a/packages/google_identity_services_web/example/lib/main.dart +++ b/packages/google_identity_services_web/example/lib/main.dart @@ -28,6 +28,7 @@ void main() async { id.prompt(onPromptMoment); // #docregion use-loader } + // #enddocregion use-loader /// Handles the ID token returned from the One Tap prompt. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/README.md b/packages/google_maps_flutter/google_maps_flutter_android/README.md index 196c4cce3936..a05840a7266f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/README.md +++ b/packages/google_maps_flutter/google_maps_flutter_android/README.md @@ -35,6 +35,7 @@ void main() { } // ··· } + ``` ### Texture Layer Hybrid Composition diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/readme_excerpts.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/readme_excerpts.dart index d24c2f8a6d17..934e6171cedd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/readme_excerpts.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/readme_excerpts.dart @@ -21,6 +21,7 @@ void main() { runApp(const MyApp()); // #docregion DisplayMode } + // #enddocregion DisplayMode class MyApp extends StatefulWidget { diff --git a/packages/image_picker/image_picker/README.md b/packages/image_picker/image_picker/README.md index 49206f0315a8..d071ce82729d 100755 --- a/packages/image_picker/image_picker/README.md +++ b/packages/image_picker/image_picker/README.md @@ -72,6 +72,7 @@ Future getLostData() async { _handleError(response.exception); } } + ``` This check should always be run at startup in order to detect and handle this @@ -117,6 +118,7 @@ implementations allow delegating to a camera handler by setting a ```dart import 'package:image_picker_platform_interface/image_picker_platform_interface.dart'; + // ··· class MyCameraDelegate extends ImagePickerCameraDelegate { @override @@ -135,6 +137,7 @@ class MyCameraDelegate extends ImagePickerCameraDelegate { return _takeAVideo(options.preferredCameraDevice); } } + // ··· void setUpCameraDelegate() { final ImagePickerPlatform instance = ImagePickerPlatform.instance; @@ -142,6 +145,7 @@ void setUpCameraDelegate() { instance.cameraDelegate = MyCameraDelegate(); } } + ``` Once you have set a `cameraDelegate`, `image_picker` calls with diff --git a/packages/image_picker/image_picker/example/lib/readme_excerpts.dart b/packages/image_picker/image_picker/example/lib/readme_excerpts.dart index 8f52ca531559..32a4a9f97c6e 100644 --- a/packages/image_picker/image_picker/example/lib/readme_excerpts.dart +++ b/packages/image_picker/image_picker/example/lib/readme_excerpts.dart @@ -6,6 +6,7 @@ import 'package:flutter/services.dart'; import 'package:image_picker/image_picker.dart'; // #docregion CameraDelegate import 'package:image_picker_platform_interface/image_picker_platform_interface.dart'; + // #enddocregion CameraDelegate /// Example of a camera delegate @@ -27,6 +28,7 @@ class MyCameraDelegate extends ImagePickerCameraDelegate { return _takeAVideo(options.preferredCameraDevice); } } + // #enddocregion CameraDelegate /// Example function for README demonstration of various pick* calls. @@ -78,6 +80,7 @@ Future getLostData() async { _handleError(response.exception); } } + // #enddocregion LostData /// Example of camera delegate setup. @@ -88,6 +91,7 @@ void setUpCameraDelegate() { instance.cameraDelegate = MyCameraDelegate(); } } + // #enddocregion CameraDelegate // Stubs for the getLostData function. diff --git a/packages/in_app_purchase/in_app_purchase_android/example/lib/migration_guide_examples.dart b/packages/in_app_purchase/in_app_purchase_android/example/lib/migration_guide_examples.dart index 33e1e930ab87..75f2cf145f11 100644 --- a/packages/in_app_purchase/in_app_purchase_android/example/lib/migration_guide_examples.dart +++ b/packages/in_app_purchase/in_app_purchase_android/example/lib/migration_guide_examples.dart @@ -21,6 +21,7 @@ void handleOneTimePurchasePrice(ProductDetails productDetails) { } } } + // #enddocregion one-time-purchase-price // #docregion subscription-free-trial @@ -39,6 +40,7 @@ void handleFreeTrialPeriod(ProductDetails productDetails) { } } } + // #enddocregion subscription-free-trial // #docregion subscription-introductory-price diff --git a/packages/in_app_purchase/in_app_purchase_android/migration_guide.md b/packages/in_app_purchase/in_app_purchase_android/migration_guide.md index 5d0ef0a7d917..cb81042b31b5 100644 --- a/packages/in_app_purchase/in_app_purchase_android/migration_guide.md +++ b/packages/in_app_purchase/in_app_purchase_android/migration_guide.md @@ -62,6 +62,7 @@ void handleOneTimePurchasePrice(ProductDetails productDetails) { } } } + ``` ### Use case: free trials @@ -101,6 +102,7 @@ void handleFreeTrialPeriod(ProductDetails productDetails) { } } } + ``` ### Use case: introductory prices diff --git a/packages/interactive_media_ads/README.md b/packages/interactive_media_ads/README.md index ce0c64743f48..d643d9c76cd1 100644 --- a/packages/interactive_media_ads/README.md +++ b/packages/interactive_media_ads/README.md @@ -87,6 +87,7 @@ already be added to your `pubspec.yaml`. ```dart import 'package:interactive_media_ads/interactive_media_ads.dart'; import 'package:video_player/video_player.dart'; + ``` ### 3. Create a New Widget @@ -221,6 +222,7 @@ void initState() { setState(() {}); }); } + ``` ### 5. Implement the `build` Method @@ -322,6 +324,7 @@ Future _pauseContent() { _contentProgressTimer = null; return _contentVideoController.pause(); } + ``` ### 7. Dispose Resources @@ -338,6 +341,7 @@ void dispose() { _adsManager?.destroy(); // ··· } + ``` That's it! You're now requesting and displaying ads with the IMA SDK. To learn about additional SDK diff --git a/packages/interactive_media_ads/example/lib/readme_example.dart b/packages/interactive_media_ads/example/lib/readme_example.dart index 0165be8a58e4..2077d806ca84 100644 --- a/packages/interactive_media_ads/example/lib/readme_example.dart +++ b/packages/interactive_media_ads/example/lib/readme_example.dart @@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; // #docregion imports import 'package:interactive_media_ads/interactive_media_ads.dart'; import 'package:video_player/video_player.dart'; + // #enddocregion imports // #docregion example_widget @@ -129,6 +130,7 @@ class _AdExampleWidgetState extends State setState(() {}); }); } + // #enddocregion ad_and_content_players @override @@ -197,6 +199,7 @@ class _AdExampleWidgetState extends State _contentProgressTimer = null; return _contentVideoController.pause(); } + // #enddocregion request_ads // #docregion dispose @@ -210,6 +213,7 @@ class _AdExampleWidgetState extends State WidgetsBinding.instance.removeObserver(this); // #docregion dispose } + // #enddocregion dispose // #docregion example_widget diff --git a/packages/interactive_media_ads/lib/src/ios/interactive_media_ads.g.dart b/packages/interactive_media_ads/lib/src/ios/interactive_media_ads.g.dart index 8f8c327c92f5..577cd3a3acd1 100644 --- a/packages/interactive_media_ads/lib/src/ios/interactive_media_ads.g.dart +++ b/packages/interactive_media_ads/lib/src/ios/interactive_media_ads.g.dart @@ -2626,14 +2626,13 @@ class IMAAdsRequest extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [ - pigeonVar_instanceIdentifier, - adTagUrl, - adDisplayContainer, - contentPlayhead, - ], - ); + final Future pigeonVar_sendFuture = pigeonVar_channel + .send([ + pigeonVar_instanceIdentifier, + adTagUrl, + adDisplayContainer, + contentPlayhead, + ]); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -2707,14 +2706,13 @@ class IMAAdsRequest extends NSObject { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [ - pigeonVar_instanceIdentifier, - adsResponse, - adDisplayContainer, - contentPlayhead, - ], - ); + final Future pigeonVar_sendFuture = pigeonVar_channel + .send([ + pigeonVar_instanceIdentifier, + adsResponse, + adDisplayContainer, + contentPlayhead, + ]); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { diff --git a/packages/local_auth/local_auth/README.md b/packages/local_auth/local_auth/README.md index 18db3fd763f9..21061eeafb19 100644 --- a/packages/local_auth/local_auth/README.md +++ b/packages/local_auth/local_auth/README.md @@ -107,6 +107,7 @@ packages. For instance, to customize Android and iOS: ```dart import 'package:local_auth_android/local_auth_android.dart'; import 'package:local_auth_darwin/local_auth_darwin.dart'; + // ··· final bool didAuthenticate = await auth.authenticate( localizedReason: 'Please authenticate to show account balance', diff --git a/packages/local_auth/local_auth/example/lib/readme_excerpts.dart b/packages/local_auth/local_auth/example/lib/readme_excerpts.dart index 928e4ee97554..36ace887bdc8 100644 --- a/packages/local_auth/local_auth/example/lib/readme_excerpts.dart +++ b/packages/local_auth/local_auth/example/lib/readme_excerpts.dart @@ -17,6 +17,7 @@ import 'package:local_auth/local_auth.dart'; // #docregion CustomMessages import 'package:local_auth_android/local_auth_android.dart'; import 'package:local_auth_darwin/local_auth_darwin.dart'; + // #enddocregion CustomMessages void main() { diff --git a/packages/metrics_center/test/flutter_test.dart b/packages/metrics_center/test/flutter_test.dart index 44cb155d41d2..a94cde7556e4 100644 --- a/packages/metrics_center/test/flutter_test.dart +++ b/packages/metrics_center/test/flutter_test.dart @@ -40,20 +40,16 @@ void main() { final Map? credentialsJson = getTestGcpCredentialsJson(); - test( - 'FlutterDestination integration test with update.', - () async { - final FlutterDestination dst = - await FlutterDestination.makeFromCredentialsJson( - credentialsJson!, - isTesting: true, - ); - await dst.update( - [simplePoint], - DateTime.fromMillisecondsSinceEpoch(123), - 'test', - ); - }, - skip: credentialsJson == null, - ); + test('FlutterDestination integration test with update.', () async { + final FlutterDestination dst = + await FlutterDestination.makeFromCredentialsJson( + credentialsJson!, + isTesting: true, + ); + await dst.update( + [simplePoint], + DateTime.fromMillisecondsSinceEpoch(123), + 'test', + ); + }, skip: credentialsJson == null); } diff --git a/packages/metrics_center/test/gcs_lock_test.dart b/packages/metrics_center/test/gcs_lock_test.dart index 4dbbb2b1cd68..ae42bdad1a13 100644 --- a/packages/metrics_center/test/gcs_lock_test.dart +++ b/packages/metrics_center/test/gcs_lock_test.dart @@ -66,63 +66,55 @@ void main() { expect(prints, equals([kExpectedErrorMessage, 'Stop!'])); }); - test( - 'GcsLock integration test: single protectedRun is successful', - () async { - final AutoRefreshingAuthClient client = await clientViaServiceAccount( - ServiceAccountCredentials.fromJson(credentialsJson), - Storage.SCOPES, - ); - final lock = GcsLock(StorageApi(client), kTestBucketName); - var testValue = 0; - await lock.protectedRun('test.lock', () async { - testValue = 1; - }); - expect(testValue, 1); - }, - skip: credentialsJson == null, - ); - - test( - 'GcsLock integration test: protectedRun is exclusive', - () async { - final AutoRefreshingAuthClient client = await clientViaServiceAccount( - ServiceAccountCredentials.fromJson(credentialsJson), - Storage.SCOPES, - ); - final lock1 = GcsLock(StorageApi(client), kTestBucketName); - final lock2 = GcsLock(StorageApi(client), kTestBucketName); - - TestPhase phase = TestPhase.run1; - final started1 = Completer(); - final Future finished1 = lock1.protectedRun('test.lock', () async { - started1.complete(); - while (phase == TestPhase.run1) { - await Future.delayed(kDelayStep); - } - }); + test('GcsLock integration test: single protectedRun is successful', () async { + final AutoRefreshingAuthClient client = await clientViaServiceAccount( + ServiceAccountCredentials.fromJson(credentialsJson), + Storage.SCOPES, + ); + final lock = GcsLock(StorageApi(client), kTestBucketName); + var testValue = 0; + await lock.protectedRun('test.lock', () async { + testValue = 1; + }); + expect(testValue, 1); + }, skip: credentialsJson == null); - await started1.future; + test('GcsLock integration test: protectedRun is exclusive', () async { + final AutoRefreshingAuthClient client = await clientViaServiceAccount( + ServiceAccountCredentials.fromJson(credentialsJson), + Storage.SCOPES, + ); + final lock1 = GcsLock(StorageApi(client), kTestBucketName); + final lock2 = GcsLock(StorageApi(client), kTestBucketName); + + TestPhase phase = TestPhase.run1; + final started1 = Completer(); + final Future finished1 = lock1.protectedRun('test.lock', () async { + started1.complete(); + while (phase == TestPhase.run1) { + await Future.delayed(kDelayStep); + } + }); - final started2 = Completer(); - final Future finished2 = lock2.protectedRun('test.lock', () async { - started2.complete(); - }); + await started1.future; + + final started2 = Completer(); + final Future finished2 = lock2.protectedRun('test.lock', () async { + started2.complete(); + }); - // started2 should not be set even after a long wait because lock1 is - // holding the GCS lock file. - await Future.delayed(kDelayStep * 10); - expect(started2.isCompleted, false); - - // When phase is switched to run2, lock1 should be released soon and - // lock2 should soon be able to proceed its protectedRun. - phase = TestPhase.run2; - await started2.future; - await finished1; - await finished2; - }, - skip: credentialsJson == null, - ); + // started2 should not be set even after a long wait because lock1 is + // holding the GCS lock file. + await Future.delayed(kDelayStep * 10); + expect(started2.isCompleted, false); + + // When phase is switched to run2, lock1 should be released soon and + // lock2 should soon be able to proceed its protectedRun. + phase = TestPhase.run2; + await started2.future; + await finished1; + await finished2; + }, skip: credentialsJson == null); test('GcsLock attempts to unlock again on a DetailedApiRequestError', () async { fakeAsync((FakeAsync fakeAsync) { diff --git a/packages/metrics_center/test/skiaperf_test.dart b/packages/metrics_center/test/skiaperf_test.dart index 864ac46cb7a5..dd29d4e996e6 100644 --- a/packages/metrics_center/test/skiaperf_test.dart +++ b/packages/metrics_center/test/skiaperf_test.dart @@ -527,45 +527,37 @@ Future main() async { // `SkiaPerfGcsAdaptor.computeObjectName` uses `GithubHelper` which requires // network connections. Hence we put them as integration tests instead of unit // tests. - test( - 'SkiaPerfGcsAdaptor integration test for name computations', - () async { - expect( - await SkiaPerfGcsAdaptor.computeObjectName( - kFlutterFrameworkRepo, - kFrameworkRevision1, - DateTime.utc(2019, 12, 04, 23), - 'test', - ), - equals( - 'flutter-flutter/2019/12/04/23/$kFrameworkRevision1/test_values.json', - ), - ); - expect( - await SkiaPerfGcsAdaptor.computeObjectName( - kFlutterEngineRepo, - kEngineRevision1, - DateTime.utc(2019, 12, 03, 20), - 'test', - ), - equals( - 'flutter-engine/2019/12/03/20/$kEngineRevision1/test_values.json', - ), - ); - expect( - await SkiaPerfGcsAdaptor.computeObjectName( - kFlutterEngineRepo, - kEngineRevision2, - DateTime.utc(2020, 01, 03, 15), - 'test', - ), - equals( - 'flutter-engine/2020/01/03/15/$kEngineRevision2/test_values.json', - ), - ); - }, - skip: testBucket == null, - ); + test('SkiaPerfGcsAdaptor integration test for name computations', () async { + expect( + await SkiaPerfGcsAdaptor.computeObjectName( + kFlutterFrameworkRepo, + kFrameworkRevision1, + DateTime.utc(2019, 12, 04, 23), + 'test', + ), + equals( + 'flutter-flutter/2019/12/04/23/$kFrameworkRevision1/test_values.json', + ), + ); + expect( + await SkiaPerfGcsAdaptor.computeObjectName( + kFlutterEngineRepo, + kEngineRevision1, + DateTime.utc(2019, 12, 03, 20), + 'test', + ), + equals('flutter-engine/2019/12/03/20/$kEngineRevision1/test_values.json'), + ); + expect( + await SkiaPerfGcsAdaptor.computeObjectName( + kFlutterEngineRepo, + kEngineRevision2, + DateTime.utc(2020, 01, 03, 15), + 'test', + ), + equals('flutter-engine/2020/01/03/15/$kEngineRevision2/test_values.json'), + ); + }, skip: testBucket == null); test('SkiaPerfDestination.update awaits locks', () async { var updateCompleted = false; diff --git a/packages/path_provider/path_provider_foundation/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider_foundation/example/integration_test/path_provider_test.dart index 9ad8b748b972..076a7bc1e2eb 100644 --- a/packages/path_provider/path_provider_foundation/example/integration_test/path_provider_test.dart +++ b/packages/path_provider/path_provider_foundation/example/integration_test/path_provider_test.dart @@ -342,35 +342,33 @@ void main() { ); }); - testWidgets( - 'getApplicationCachePath creates the directory if necessary', - (_) async { - final mockFfiLib = MockFoundationFFI(); - final pathProvider = PathProviderFoundation( - ffiLib: mockFfiLib, - platform: platformVariants.currentValue, - ); + testWidgets('getApplicationCachePath creates the directory if necessary', ( + _, + ) async { + final mockFfiLib = MockFoundationFFI(); + final pathProvider = PathProviderFoundation( + ffiLib: mockFfiLib, + platform: platformVariants.currentValue, + ); - final String applicationCachePath = p.join( - testRoot.path, - 'application', - 'cache', - 'path', - ); - when( - mockFfiLib.NSSearchPathForDirectoriesInDomains( - NSSearchPathDirectory.NSCachesDirectory, - NSSearchPathDomainMask.NSUserDomainMask, - true, - ), - ).thenReturn(_arrayWithString(applicationCachePath)); + final String applicationCachePath = p.join( + testRoot.path, + 'application', + 'cache', + 'path', + ); + when( + mockFfiLib.NSSearchPathForDirectoriesInDomains( + NSSearchPathDirectory.NSCachesDirectory, + NSSearchPathDomainMask.NSUserDomainMask, + true, + ), + ).thenReturn(_arrayWithString(applicationCachePath)); - final String? path = await pathProvider.getApplicationCachePath(); + final String? path = await pathProvider.getApplicationCachePath(); - expect(Directory(path!).existsSync(), isTrue); - }, - variant: platformVariants, - ); + expect(Directory(path!).existsSync(), isTrue); + }, variant: platformVariants); testWidgets('getDownloadsPath', (_) async { final mockFfiLib = MockFoundationFFI(); diff --git a/packages/path_provider/path_provider_windows/test/path_provider_windows_test.dart b/packages/path_provider/path_provider_windows/test/path_provider_windows_test.dart index 5ef6c87299a6..0278d6685199 100644 --- a/packages/path_provider/path_provider_windows/test/path_provider_windows_test.dart +++ b/packages/path_provider/path_provider_windows/test/path_provider_windows_test.dart @@ -61,41 +61,33 @@ void main() { expect(path, endsWith(r'flutter_tester')); }, skip: !Platform.isWindows); - test( - 'getApplicationSupportPath with full version info in CP1252', - () async { - final pathProvider = PathProviderWindows(); - pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ - 'CompanyName': 'A Company', - 'ProductName': 'Amazing App', - }, encoding: encodingCP1252); - final String? path = await pathProvider.getApplicationSupportPath(); - expect(path, isNotNull); - if (path != null) { - expect(path, endsWith(r'AppData\Roaming\A Company\Amazing App')); - expect(Directory(path).existsSync(), isTrue); - } - }, - skip: !Platform.isWindows, - ); + test('getApplicationSupportPath with full version info in CP1252', () async { + final pathProvider = PathProviderWindows(); + pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ + 'CompanyName': 'A Company', + 'ProductName': 'Amazing App', + }, encoding: encodingCP1252); + final String? path = await pathProvider.getApplicationSupportPath(); + expect(path, isNotNull); + if (path != null) { + expect(path, endsWith(r'AppData\Roaming\A Company\Amazing App')); + expect(Directory(path).existsSync(), isTrue); + } + }, skip: !Platform.isWindows); - test( - 'getApplicationSupportPath with full version info in Unicode', - () async { - final pathProvider = PathProviderWindows(); - pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ - 'CompanyName': 'A Company', - 'ProductName': 'Amazing App', - }); - final String? path = await pathProvider.getApplicationSupportPath(); - expect(path, isNotNull); - if (path != null) { - expect(path, endsWith(r'AppData\Roaming\A Company\Amazing App')); - expect(Directory(path).existsSync(), isTrue); - } - }, - skip: !Platform.isWindows, - ); + test('getApplicationSupportPath with full version info in Unicode', () async { + final pathProvider = PathProviderWindows(); + pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ + 'CompanyName': 'A Company', + 'ProductName': 'Amazing App', + }); + final String? path = await pathProvider.getApplicationSupportPath(); + expect(path, isNotNull); + if (path != null) { + expect(path, endsWith(r'AppData\Roaming\A Company\Amazing App')); + expect(Directory(path).existsSync(), isTrue); + } + }, skip: !Platform.isWindows); test( 'getApplicationSupportPath with full version info in Unsupported Encoding', @@ -150,23 +142,19 @@ void main() { } }, skip: !Platform.isWindows); - test( - 'getApplicationSupportPath with a completely invalid company', - () async { - final pathProvider = PathProviderWindows(); - pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ - 'CompanyName': r'..', - 'ProductName': r'Amazing App', - }); - final String? path = await pathProvider.getApplicationSupportPath(); - expect(path, isNotNull); - if (path != null) { - expect(path, endsWith(r'AppData\Roaming\Amazing App')); - expect(Directory(path).existsSync(), isTrue); - } - }, - skip: !Platform.isWindows, - ); + test('getApplicationSupportPath with a completely invalid company', () async { + final pathProvider = PathProviderWindows(); + pathProvider.versionInfoQuerier = FakeVersionInfoQuerier({ + 'CompanyName': r'..', + 'ProductName': r'Amazing App', + }); + final String? path = await pathProvider.getApplicationSupportPath(); + expect(path, isNotNull); + if (path != null) { + expect(path, endsWith(r'AppData\Roaming\Amazing App')); + expect(Directory(path).existsSync(), isTrue); + } + }, skip: !Platform.isWindows); test('getApplicationSupportPath with very long app name', () async { final pathProvider = PathProviderWindows(); diff --git a/packages/pigeon/example/README.md b/packages/pigeon/example/README.md index 1ce5a202cb7b..b54f7c08737e 100644 --- a/packages/pigeon/example/README.md +++ b/packages/pigeon/example/README.md @@ -79,6 +79,7 @@ abstract class ExampleHostApi { @async bool sendMessage(MessageData message); } + ``` ### Dart @@ -115,6 +116,7 @@ Future sendMessage(String messageText) { return Future(() => true); } } + ``` ### Swift @@ -268,6 +270,7 @@ class _ExampleFlutterApi implements MessageFlutterApi { return aString ?? ''; } } + // ··· MessageFlutterApi.setUp(_ExampleFlutterApi()); ``` @@ -397,6 +400,7 @@ Stream getEventStream() async* { } } } + ``` ### Swift diff --git a/packages/pigeon/example/app/lib/main.dart b/packages/pigeon/example/app/lib/main.dart index eeb193aa1f6a..09f1d7be1373 100644 --- a/packages/pigeon/example/app/lib/main.dart +++ b/packages/pigeon/example/app/lib/main.dart @@ -19,6 +19,7 @@ class _ExampleFlutterApi implements MessageFlutterApi { return aString ?? ''; } } + // #enddocregion main-dart-flutter void main() { @@ -86,6 +87,7 @@ class _MyHomePageState extends State { return Future(() => true); } } + // #enddocregion main-dart // #docregion main-dart-event @@ -102,6 +104,7 @@ class _MyHomePageState extends State { } } } + // #enddocregion main-dart-event @override diff --git a/packages/pigeon/example/app/pigeons/event_channel_messages.dart b/packages/pigeon/example/app/pigeons/event_channel_messages.dart index c786e8204f9a..39e7b0faf4ab 100644 --- a/packages/pigeon/example/app/pigeons/event_channel_messages.dart +++ b/packages/pigeon/example/app/pigeons/event_channel_messages.dart @@ -30,6 +30,7 @@ class StringEvent extends PlatformEvent { StringEvent(this.data); String data; } + // #enddocregion sealed-definitions // #docregion event-definitions diff --git a/packages/pigeon/example/app/pigeons/messages.dart b/packages/pigeon/example/app/pigeons/messages.dart index 7e3d08a799e2..04d58081dbbd 100644 --- a/packages/pigeon/example/app/pigeons/messages.dart +++ b/packages/pigeon/example/app/pigeons/messages.dart @@ -54,6 +54,7 @@ abstract class ExampleHostApi { @async bool sendMessage(MessageData message); } + // #enddocregion host-definitions // #docregion flutter-definitions diff --git a/packages/pigeon/lib/src/java/java_generator.dart b/packages/pigeon/lib/src/java/java_generator.dart index 4b7f792dc1c3..5ef1c93e33cf 100644 --- a/packages/pigeon/lib/src/java/java_generator.dart +++ b/packages/pigeon/lib/src/java/java_generator.dart @@ -1090,46 +1090,41 @@ if (wrapped == null) { indent.writeln('$sendArgument,'); indent.write('channelReply -> '); indent.addScoped('{', '});', () { - indent.writeScoped( - 'if (channelReply instanceof List) {', - '} ', - () { + indent.writeScoped('if (channelReply instanceof List) {', '} ', () { + indent.writeln( + 'List listReply = (List) channelReply;', + ); + indent.writeScoped('if (listReply.size() > 1) {', '} ', () { indent.writeln( - 'List listReply = (List) channelReply;', + 'result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2)));', ); - indent.writeScoped('if (listReply.size() > 1) {', '} ', () { - indent.writeln( - 'result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2)));', - ); - }, addTrailingNewline: false); - if (!func.returnType.isNullable && !func.returnType.isVoid) { - indent.addScoped( - 'else if (listReply.get(0) == null) {', - '} ', - () { - indent.writeln( - 'result.error(new FlutterError("null-error", "Flutter api returned null value for non-null return value.", ""));', - ); - }, - addTrailingNewline: false, - ); + }, addTrailingNewline: false); + if (!func.returnType.isNullable && !func.returnType.isVoid) { + indent.addScoped( + 'else if (listReply.get(0) == null) {', + '} ', + () { + indent.writeln( + 'result.error(new FlutterError("null-error", "Flutter api returned null value for non-null return value.", ""));', + ); + }, + addTrailingNewline: false, + ); + } + indent.addScoped('else {', '}', () { + if (func.returnType.isVoid) { + indent.writeln('result.success();'); + } else { + const output = 'output'; + final String outputExpression; + indent.writeln('@SuppressWarnings("ConstantConditions")'); + outputExpression = + '${_cast('listReply.get(0)', javaType: returnType)};'; + indent.writeln('$returnType $output = $outputExpression'); + indent.writeln('result.success($output);'); } - indent.addScoped('else {', '}', () { - if (func.returnType.isVoid) { - indent.writeln('result.success();'); - } else { - const output = 'output'; - final String outputExpression; - indent.writeln('@SuppressWarnings("ConstantConditions")'); - outputExpression = - '${_cast('listReply.get(0)', javaType: returnType)};'; - indent.writeln('$returnType $output = $outputExpression'); - indent.writeln('result.success($output);'); - } - }); - }, - addTrailingNewline: false, - ); + }); + }, addTrailingNewline: false); indent.addScoped(' else {', '} ', () { indent.writeln( 'result.error(createConnectionError(channelName));', diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart index 9ed43123a701..55afaa5ac235 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart @@ -3265,87 +3265,75 @@ void runPigeonIntegrationTests(TargetGenerator targetGenerator) { TargetGenerator.swift, ]; - testWidgets( - 'event channel sends continuous ints', - (_) async { - final Stream events = streamInts(); - final List listEvents = await events.toList(); - for (final value in listEvents) { - expect(listEvents[value], value); + testWidgets('event channel sends continuous ints', (_) async { + final Stream events = streamInts(); + final List listEvents = await events.toList(); + for (final value in listEvents) { + expect(listEvents[value], value); + } + }, skip: !eventChannelSupported.contains(targetGenerator)); + + testWidgets('event channel handles extended sealed classes', (_) async { + final completer = Completer(); + var count = 0; + final Stream events = streamEvents(); + events.listen((PlatformEvent event) { + switch (event) { + case IntEvent(): + expect(event.value, 1); + expect(count, 0); + count++; + case StringEvent(): + expect(event.value, 'string'); + expect(count, 1); + count++; + case BoolEvent(): + expect(event.value, false); + expect(count, 2); + count++; + case DoubleEvent(): + expect(event.value, 3.14); + expect(count, 3); + count++; + case ObjectsEvent(): + expect(event.value, true); + expect(count, 4); + count++; + case EnumEvent(): + expect(event.value, EventEnum.fortyTwo); + expect(count, 5); + count++; + case ClassEvent(): + expect(event.value.aNullableInt, 0); + expect(count, 6); + count++; + completer.complete(); } - }, - skip: !eventChannelSupported.contains(targetGenerator), - ); - - testWidgets( - 'event channel handles extended sealed classes', - (_) async { - final completer = Completer(); - var count = 0; - final Stream events = streamEvents(); - events.listen((PlatformEvent event) { - switch (event) { - case IntEvent(): - expect(event.value, 1); - expect(count, 0); - count++; - case StringEvent(): - expect(event.value, 'string'); - expect(count, 1); - count++; - case BoolEvent(): - expect(event.value, false); - expect(count, 2); - count++; - case DoubleEvent(): - expect(event.value, 3.14); - expect(count, 3); - count++; - case ObjectsEvent(): - expect(event.value, true); - expect(count, 4); - count++; - case EnumEvent(): - expect(event.value, EventEnum.fortyTwo); - expect(count, 5); - count++; - case ClassEvent(): - expect(event.value.aNullableInt, 0); - expect(count, 6); - count++; - completer.complete(); - } - }); - await completer.future; - }, - skip: !eventChannelSupported.contains(targetGenerator), - ); - - testWidgets( - 'event channels handle multiple instances', - (_) async { - final completer1 = Completer(); - final completer2 = Completer(); - final Stream events1 = streamConsistentNumbers(instanceName: '1'); - final Stream events2 = streamConsistentNumbers(instanceName: '2'); - - events1 - .listen((int event) { - expect(event, 1); - }) - .onDone(() => completer1.complete()); - - events2 - .listen((int event) { - expect(event, 2); - }) - .onDone(() => completer2.complete()); - - await completer1.future; - await completer2.future; - }, - skip: !eventChannelSupported.contains(targetGenerator), - ); + }); + await completer.future; + }, skip: !eventChannelSupported.contains(targetGenerator)); + + testWidgets('event channels handle multiple instances', (_) async { + final completer1 = Completer(); + final completer2 = Completer(); + final Stream events1 = streamConsistentNumbers(instanceName: '1'); + final Stream events2 = streamConsistentNumbers(instanceName: '2'); + + events1 + .listen((int event) { + expect(event, 1); + }) + .onDone(() => completer1.complete()); + + events2 + .listen((int event) { + expect(event, 2); + }) + .onDone(() => completer2.complete()); + + await completer1.future; + await completer2.future; + }, skip: !eventChannelSupported.contains(targetGenerator)); } class _FlutterApiTestImplementation implements FlutterIntegrationCoreApi { diff --git a/packages/plugin_platform_interface/README.md b/packages/plugin_platform_interface/README.md index c53b98dc2141..48bbdb1a7e8a 100644 --- a/packages/plugin_platform_interface/README.md +++ b/packages/plugin_platform_interface/README.md @@ -40,6 +40,7 @@ abstract class SamplePluginPlatform extends PlatformInterface { class SamplePluginDefault extends SamplePluginPlatform { // A default real implementation of the platform interface would go here. } + ``` This guarantees that UrlLauncherPlatform.instance cannot be set to an object that `implements` @@ -60,6 +61,7 @@ For example, a Mockito mock of a platform interface can be created with: class SamplePluginPlatformMock extends Mock with MockPlatformInterfaceMixin implements SamplePluginPlatform {} + ``` ## A note about `base` diff --git a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart index 3b4d97338216..1a82aa2a81a3 100644 --- a/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart +++ b/packages/plugin_platform_interface/test/plugin_platform_interface_test.dart @@ -36,6 +36,7 @@ abstract class SamplePluginPlatform extends PlatformInterface { class SamplePluginDefault extends SamplePluginPlatform { // A default real implementation of the platform interface would go here. } + // #enddocregion Example class ImplementsSamplePluginPlatform extends Mock @@ -51,6 +52,7 @@ class ImplementsSamplePluginPlatformUsingNoSuchMethod class SamplePluginPlatformMock extends Mock with MockPlatformInterfaceMixin implements SamplePluginPlatform {} + // #enddocregion Mock class SamplePluginPlatformFake extends Fake diff --git a/packages/shared_preferences/shared_preferences/README.md b/packages/shared_preferences/shared_preferences/README.md index 94aefa7b8906..6e3bd23db36b 100644 --- a/packages/shared_preferences/shared_preferences/README.md +++ b/packages/shared_preferences/shared_preferences/README.md @@ -58,6 +58,7 @@ To use the `Android SharedPreferences` backend, use the `SharedPreferencesAsyncA ```dart import 'package:shared_preferences_android/shared_preferences_android.dart'; + ``` ```dart @@ -172,6 +173,7 @@ This can be run on every launch without data loss as long as the `migrationCompl ```dart import 'package:shared_preferences/util/legacy_to_async_migration_util.dart'; + // ··· const sharedPreferencesOptions = SharedPreferencesOptions(); final SharedPreferences prefs = await SharedPreferences.getInstance(); diff --git a/packages/shared_preferences/shared_preferences/example/lib/main.dart b/packages/shared_preferences/shared_preferences/example/lib/main.dart index 092cfbafb403..32a66279c366 100644 --- a/packages/shared_preferences/shared_preferences/example/lib/main.dart +++ b/packages/shared_preferences/shared_preferences/example/lib/main.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; // #docregion migrate import 'package:shared_preferences/util/legacy_to_async_migration_util.dart'; + // #enddocregion migrate void main() { diff --git a/packages/shared_preferences/shared_preferences/example/lib/readme_excerpts.dart b/packages/shared_preferences/shared_preferences/example/lib/readme_excerpts.dart index b917383df8b6..50aa96208b3a 100644 --- a/packages/shared_preferences/shared_preferences/example/lib/readme_excerpts.dart +++ b/packages/shared_preferences/shared_preferences/example/lib/readme_excerpts.dart @@ -6,6 +6,7 @@ import 'package:shared_preferences/shared_preferences.dart'; // #docregion Android_Options1 import 'package:shared_preferences_android/shared_preferences_android.dart'; + // #enddocregion Android_Options1 Future readmeSnippets() async { diff --git a/packages/shared_preferences/shared_preferences_android/README.md b/packages/shared_preferences/shared_preferences_android/README.md index 898e0c0c3e63..67342f52a770 100644 --- a/packages/shared_preferences/shared_preferences_android/README.md +++ b/packages/shared_preferences/shared_preferences_android/README.md @@ -26,6 +26,7 @@ const SharedPreferencesAsyncAndroidOptions options = fileName: 'the_name_of_a_file', ), ); + ``` The [SharedPreferences] API uses the native [Android SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences) tool to store data. diff --git a/packages/shared_preferences/shared_preferences_android/example/lib/main.dart b/packages/shared_preferences/shared_preferences_android/example/lib/main.dart index 6003ba8c62a5..d40326766f47 100644 --- a/packages/shared_preferences/shared_preferences_android/example/lib/main.dart +++ b/packages/shared_preferences/shared_preferences_android/example/lib/main.dart @@ -20,6 +20,7 @@ const SharedPreferencesAsyncAndroidOptions options = fileName: 'the_name_of_a_file', ), ); + // #enddocregion Android_Options class MyApp extends StatelessWidget { diff --git a/packages/standard_message_codec/test/standard_message_codec_test.dart b/packages/standard_message_codec/test/standard_message_codec_test.dart index 273b3b918974..b0de991c5422 100644 --- a/packages/standard_message_codec/test/standard_message_codec_test.dart +++ b/packages/standard_message_codec/test/standard_message_codec_test.dart @@ -68,18 +68,14 @@ void main() { expect(read.getInt64(), equals(-9000000000000)); }, testOn: 'vm' /* Int64 isn't supported on web */); - test( - 'of 64-bit integer in big endian', - () { - final write = WriteBuffer(); - write.putInt64(-9000000000000, endian: Endian.big); - final ByteData written = write.done(); - expect(written.lengthInBytes, equals(8)); - final read = ReadBuffer(written); - expect(read.getInt64(endian: Endian.big), equals(-9000000000000)); - }, - testOn: 'vm' /* Int64 isn't supported on web */, - ); + test('of 64-bit integer in big endian', () { + final write = WriteBuffer(); + write.putInt64(-9000000000000, endian: Endian.big); + final ByteData written = write.done(); + expect(written.lengthInBytes, equals(8)); + final read = ReadBuffer(written); + expect(read.getInt64(endian: Endian.big), equals(-9000000000000)); + }, testOn: 'vm' /* Int64 isn't supported on web */); test('of double', () { final write = WriteBuffer(); @@ -109,21 +105,17 @@ void main() { expect(read.getInt32List(3), equals(integers)); }); - test( - 'of 64-bit int list when unaligned', - () { - final integers = Int64List.fromList([-99, 2, 99]); - final write = WriteBuffer(); - write.putUint8(9); - write.putInt64List(integers); - final ByteData written = write.done(); - expect(written.lengthInBytes, equals(32)); - final read = ReadBuffer(written); - read.getUint8(); - expect(read.getInt64List(3), equals(integers)); - }, - testOn: 'vm' /* Int64 isn't supported on web */, - ); + test('of 64-bit int list when unaligned', () { + final integers = Int64List.fromList([-99, 2, 99]); + final write = WriteBuffer(); + write.putUint8(9); + write.putInt64List(integers); + final ByteData written = write.done(); + expect(written.lengthInBytes, equals(32)); + final read = ReadBuffer(written); + read.getUint8(); + expect(read.getInt64List(3), equals(integers)); + }, testOn: 'vm' /* Int64 isn't supported on web */); test('of float list when unaligned', () { final floats = Float32List.fromList([3.14, double.nan]); diff --git a/packages/url_launcher/url_launcher/README.md b/packages/url_launcher/url_launcher/README.md index 10b4ac1721aa..d45135c465a8 100644 --- a/packages/url_launcher/url_launcher/README.md +++ b/packages/url_launcher/url_launcher/README.md @@ -161,6 +161,7 @@ String? encodeQueryParameters(Map params) { ) .join('&'); } + // ··· final emailLaunchUri = Uri( scheme: 'mailto', diff --git a/packages/url_launcher/url_launcher/example/lib/encoding.dart b/packages/url_launcher/url_launcher/example/lib/encoding.dart index a2f541ebb457..2f2b29e23737 100644 --- a/packages/url_launcher/url_launcher/example/lib/encoding.dart +++ b/packages/url_launcher/url_launcher/example/lib/encoding.dart @@ -21,6 +21,7 @@ String? encodeQueryParameters(Map params) { ) .join('&'); } + // #enddocregion encode-query-parameters void main() => runApp( diff --git a/packages/video_player/video_player/test/video_player_test.dart b/packages/video_player/video_player/test/video_player_test.dart index 77608a45d0ac..4b6043341809 100644 --- a/packages/video_player/video_player/test/video_player_test.dart +++ b/packages/video_player/video_player/test/video_player_test.dart @@ -582,51 +582,35 @@ void main() { expect(uri.endsWith('/a.avi'), true, reason: 'Actual string: $uri'); }, skip: kIsWeb /* Web does not support file assets. */); - test( - 'file with special characters', - () async { - final controller = VideoPlayerController.file(File('A #1 Hit.avi')); - await controller.initialize(); + test('file with special characters', () async { + final controller = VideoPlayerController.file(File('A #1 Hit.avi')); + await controller.initialize(); - final String uri = fakeVideoPlayerPlatform.dataSources[0].uri!; - expect( - uri.startsWith('file:///'), - true, - reason: 'Actual string: $uri', - ); - expect( - uri.endsWith('/A%20%231%20Hit.avi'), - true, - reason: 'Actual string: $uri', - ); - }, - skip: kIsWeb /* Web does not support file assets. */, - ); + final String uri = fakeVideoPlayerPlatform.dataSources[0].uri!; + expect(uri.startsWith('file:///'), true, reason: 'Actual string: $uri'); + expect( + uri.endsWith('/A%20%231%20Hit.avi'), + true, + reason: 'Actual string: $uri', + ); + }, skip: kIsWeb /* Web does not support file assets. */); - test( - 'file with headers (m3u8)', - () async { - final controller = VideoPlayerController.file( - File('a.avi'), - httpHeaders: {'Authorization': 'Bearer token'}, - ); - await controller.initialize(); + test('file with headers (m3u8)', () async { + final controller = VideoPlayerController.file( + File('a.avi'), + httpHeaders: {'Authorization': 'Bearer token'}, + ); + await controller.initialize(); - final String uri = fakeVideoPlayerPlatform.dataSources[0].uri!; - expect( - uri.startsWith('file:///'), - true, - reason: 'Actual string: $uri', - ); - expect(uri.endsWith('/a.avi'), true, reason: 'Actual string: $uri'); + final String uri = fakeVideoPlayerPlatform.dataSources[0].uri!; + expect(uri.startsWith('file:///'), true, reason: 'Actual string: $uri'); + expect(uri.endsWith('/a.avi'), true, reason: 'Actual string: $uri'); - expect( - fakeVideoPlayerPlatform.dataSources[0].httpHeaders, - {'Authorization': 'Bearer token'}, - ); - }, - skip: kIsWeb /* Web does not support file assets. */, - ); + expect( + fakeVideoPlayerPlatform.dataSources[0].httpHeaders, + {'Authorization': 'Bearer token'}, + ); + }, skip: kIsWeb /* Web does not support file assets. */); test( 'successful initialize on controller with error clears error', @@ -1167,11 +1151,13 @@ void main() { } expect(isSorted, false, reason: 'Expected captions to be unsorted'); - expect( - captions.map((Caption c) => c.text).toList(), - ['one', 'two', 'three', 'five', 'four'], - reason: 'Captions should be in original unsorted order', - ); + expect(captions.map((Caption c) => c.text).toList(), [ + 'one', + 'two', + 'three', + 'five', + 'four', + ], reason: 'Captions should be in original unsorted order'); }); test('works when seeking, includes all captions', () async { diff --git a/packages/web_benchmarks/testing/test_app/benchmark/web_benchmarks_test.dart b/packages/web_benchmarks/testing/test_app/benchmark/web_benchmarks_test.dart index 6330f6b4f46c..52a469fa6e83 100644 --- a/packages/web_benchmarks/testing/test_app/benchmark/web_benchmarks_test.dart +++ b/packages/web_benchmarks/testing/test_app/benchmark/web_benchmarks_test.dart @@ -25,30 +25,26 @@ Future main() async { ); }, timeout: Timeout.none); - test( - 'Can run a web benchmark with an alternate benchmarkPath', - () async { - final BenchmarkResults results = await _runBenchmarks( - benchmarkNames: [BenchmarkName.simpleBenchmarkPathCheck.name], - entryPoint: - 'benchmark/test_infra/client/simple_benchmark_path_client.dart', - benchmarkPath: testBenchmarkPath, - ); + test('Can run a web benchmark with an alternate benchmarkPath', () async { + final BenchmarkResults results = await _runBenchmarks( + benchmarkNames: [BenchmarkName.simpleBenchmarkPathCheck.name], + entryPoint: + 'benchmark/test_infra/client/simple_benchmark_path_client.dart', + benchmarkPath: testBenchmarkPath, + ); - final List? scores = - results.scores[BenchmarkName.simpleBenchmarkPathCheck.name]; - expect(scores, isNotNull); + final List? scores = + results.scores[BenchmarkName.simpleBenchmarkPathCheck.name]; + expect(scores, isNotNull); - // The runner puts an `expectedUrl` metric in the results so that we can - // verify the initial page value that should be passed on initial load - // and on reloads. - final BenchmarkScore expectedUrlScore = scores!.firstWhere( - (BenchmarkScore score) => score.metric == 'expectedUrl', - ); - expect(expectedUrlScore.value, 1); - }, - timeout: Timeout.none, - ); + // The runner puts an `expectedUrl` metric in the results so that we can + // verify the initial page value that should be passed on initial load + // and on reloads. + final BenchmarkScore expectedUrlScore = scores!.firstWhere( + (BenchmarkScore score) => score.metric == 'expectedUrl', + ); + expect(expectedUrlScore.value, 1); + }, timeout: Timeout.none); test('Can run a web benchmark with wasm', () async { final BenchmarkResults results = await _runBenchmarks( diff --git a/packages/webview_flutter/webview_flutter/README.md b/packages/webview_flutter/webview_flutter/README.md index fa029377b323..a8ece2d9357a 100644 --- a/packages/webview_flutter/webview_flutter/README.md +++ b/packages/webview_flutter/webview_flutter/README.md @@ -80,6 +80,7 @@ Next, add the imports of the implementation packages to your app or package: import 'package:webview_flutter_android/webview_flutter_android.dart'; // Import for iOS/macOS features. import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart'; + ``` Now, additional features can be accessed through the platform implementations. Classes diff --git a/packages/webview_flutter/webview_flutter/example/lib/main.dart b/packages/webview_flutter/webview_flutter/example/lib/main.dart index 9ff1ffc5981f..9ae34e2402a4 100644 --- a/packages/webview_flutter/webview_flutter/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter/example/lib/main.dart @@ -17,6 +17,7 @@ import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter_android/webview_flutter_android.dart'; // Import for iOS/macOS features. import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart'; + // #enddocregion platform_imports void main() => runApp(const MaterialApp(home: WebViewExample())); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/legacy/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/legacy/webview_flutter_test.dart index 4f0e6e631067..145c07209222 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/legacy/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/legacy/webview_flutter_test.dart @@ -477,60 +477,58 @@ Future main() async { skip: Platform.isIOS, ); - testWidgets( - 'Video plays inline when allowsInlineMediaPlayback is true', - (WidgetTester tester) async { - final String videoTestBase64 = await getTestVideoBase64(); - final controllerCompleter = Completer(); - final pageLoaded = Completer(); - final videoPlaying = Completer(); + testWidgets('Video plays inline when allowsInlineMediaPlayback is true', ( + WidgetTester tester, + ) async { + final String videoTestBase64 = await getTestVideoBase64(); + final controllerCompleter = Completer(); + final pageLoaded = Completer(); + final videoPlaying = Completer(); - await tester.pumpWidget( - Directionality( - textDirection: TextDirection.ltr, - child: WebView( - initialUrl: - 'data:text/html;charset=utf-8;base64,$videoTestBase64', - onWebViewCreated: (WebViewController controller) { - controllerCompleter.complete(controller); - }, - javascriptMode: JavascriptMode.unrestricted, - javascriptChannels: { - JavascriptChannel( - name: 'VideoTestTime', - onMessageReceived: (JavascriptMessage message) { - final double currentTime = double.parse(message.message); - // Let it play for at least 1 second to make sure the related video's properties are set. - if (currentTime > 1 && !videoPlaying.isCompleted) { - videoPlaying.complete(null); - } - }, - ), - }, - onPageFinished: (String url) { - pageLoaded.complete(null); - }, - initialMediaPlaybackPolicy: - AutoMediaPlaybackPolicy.always_allow, - allowsInlineMediaPlayback: true, - ), + await tester.pumpWidget( + Directionality( + textDirection: TextDirection.ltr, + child: WebView( + initialUrl: + 'data:text/html;charset=utf-8;base64,$videoTestBase64', + onWebViewCreated: (WebViewController controller) { + controllerCompleter.complete(controller); + }, + javascriptMode: JavascriptMode.unrestricted, + javascriptChannels: { + JavascriptChannel( + name: 'VideoTestTime', + onMessageReceived: (JavascriptMessage message) { + final double currentTime = double.parse(message.message); + // Let it play for at least 1 second to make sure the related video's properties are set. + if (currentTime > 1 && !videoPlaying.isCompleted) { + videoPlaying.complete(null); + } + }, + ), + }, + onPageFinished: (String url) { + pageLoaded.complete(null); + }, + initialMediaPlaybackPolicy: AutoMediaPlaybackPolicy.always_allow, + allowsInlineMediaPlayback: true, ), - ); - final WebViewController controller = await controllerCompleter.future; - await pageLoaded.future; + ), + ); + final WebViewController controller = await controllerCompleter.future; + await pageLoaded.future; - // Pump once to trigger the video play. - await tester.pump(); + // Pump once to trigger the video play. + await tester.pump(); - // Makes sure we get the correct event that indicates the video is actually playing. - await videoPlaying.future; + // Makes sure we get the correct event that indicates the video is actually playing. + await videoPlaying.future; - final String fullScreen = await controller - .runJavascriptReturningResult('isFullScreen();'); - expect(fullScreen, _webviewBool(false)); - }, - skip: Platform.isMacOS || skipOnIosFor154676, - ); + final String fullScreen = await controller.runJavascriptReturningResult( + 'isFullScreen();', + ); + expect(fullScreen, _webviewBool(false)); + }, skip: Platform.isMacOS || skipOnIosFor154676); testWidgets( 'Video plays full screen when allowsInlineMediaPlayback is false', diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart index 58ce2c215269..2e8fec875f8a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart @@ -88,80 +88,78 @@ Future main() async { timeout: const Timeout(Duration(seconds: 10)), ); - testWidgets( - 'WKWebView is released by garbage collection', - (WidgetTester tester) async { - final webViewGCCompleter = Completer(); + testWidgets('WKWebView is released by garbage collection', ( + WidgetTester tester, + ) async { + final webViewGCCompleter = Completer(); - const webViewToken = -1; - final finalizer = Finalizer((int token) { - if (token == webViewToken) { - webViewGCCompleter.complete(); - } - }); + const webViewToken = -1; + final finalizer = Finalizer((int token) { + if (token == webViewToken) { + webViewGCCompleter.complete(); + } + }); - PigeonOverrides.uIViewWKWebView_new = - ({ - required WKWebViewConfiguration initialConfiguration, - void Function( - NSObject pigeonInstance, - String? keyPath, - NSObject? object, - Map? change, - )? - observeValue, - }) { - final webView = UIViewWKWebView.pigeon_new( - initialConfiguration: initialConfiguration, - ); - finalizer.attach(webView, webViewToken); - return webView; - }; - PigeonOverrides.nSViewWKWebView_new = - ({ - required WKWebViewConfiguration initialConfiguration, - void Function( - NSObject pigeonInstance, - String? keyPath, - NSObject? object, - Map? change, - )? - observeValue, - }) { - final webView = NSViewWKWebView.pigeon_new( - initialConfiguration: initialConfiguration, - ); - finalizer.attach(webView, webViewToken); - return webView; - }; - // Wait for any WebView to be garbage collected. - await tester.pumpWidget( - Builder( - builder: (BuildContext context) { - return PlatformWebViewWidget( - WebKitWebViewWidgetCreationParams( - controller: PlatformWebViewController( - WebKitWebViewControllerCreationParams(), - ), + PigeonOverrides.uIViewWKWebView_new = + ({ + required WKWebViewConfiguration initialConfiguration, + void Function( + NSObject pigeonInstance, + String? keyPath, + NSObject? object, + Map? change, + )? + observeValue, + }) { + final webView = UIViewWKWebView.pigeon_new( + initialConfiguration: initialConfiguration, + ); + finalizer.attach(webView, webViewToken); + return webView; + }; + PigeonOverrides.nSViewWKWebView_new = + ({ + required WKWebViewConfiguration initialConfiguration, + void Function( + NSObject pigeonInstance, + String? keyPath, + NSObject? object, + Map? change, + )? + observeValue, + }) { + final webView = NSViewWKWebView.pigeon_new( + initialConfiguration: initialConfiguration, + ); + finalizer.attach(webView, webViewToken); + return webView; + }; + // Wait for any WebView to be garbage collected. + await tester.pumpWidget( + Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + WebKitWebViewWidgetCreationParams( + controller: PlatformWebViewController( + WebKitWebViewControllerCreationParams(), ), - ).build(context); - }, - ), - ); - await tester.pumpAndSettle(); - await tester.pumpWidget(Container()); - - // Force garbage collection. - await IntegrationTestWidgetsFlutterBinding.instance.watchPerformance( - () async { - await tester.pumpAndSettle(); + ), + ).build(context); }, - ); + ), + ); + await tester.pumpAndSettle(); + await tester.pumpWidget(Container()); - await expectLater(webViewGCCompleter.future, completes); - }, - timeout: const Timeout(Duration(seconds: 30)), - ); + // Force garbage collection. + await IntegrationTestWidgetsFlutterBinding.instance.watchPerformance( + () async { + await tester.pumpAndSettle(); + }, + ); + + await expectLater(webViewGCCompleter.future, completes); + }, timeout: const Timeout(Duration(seconds: 30))); testWidgets('loadRequest', (WidgetTester tester) async { final pageFinished = Completer(); diff --git a/script/tool/test/analyze_command_test.dart b/script/tool/test/analyze_command_test.dart index 2cc4947e6d29..9e0b2d6a0752 100644 --- a/script/tool/test/analyze_command_test.dart +++ b/script/tool/test/analyze_command_test.dart @@ -901,11 +901,11 @@ packages/package_a/CHANGELOG.md expect( processRunner.recordedCalls, orderedEquals([ - ProcessCall( - getFlutterCommand(mockPlatform), - const ['build', 'apk', '--config-only'], - plugin.getExamples().first.directory.path, - ), + ProcessCall(getFlutterCommand(mockPlatform), const [ + 'build', + 'apk', + '--config-only', + ], plugin.getExamples().first.directory.path), ProcessCall(androidDir.childFile('gradlew').path, const [ 'plugin1:lintDebug', ], androidDir.path), diff --git a/script/tool/test/create_all_packages_app_command_test.dart b/script/tool/test/create_all_packages_app_command_test.dart index 5e807c715b58..3282ccad113f 100644 --- a/script/tool/test/create_all_packages_app_command_test.dart +++ b/script/tool/test/create_all_packages_app_command_test.dart @@ -534,11 +534,10 @@ android { expect( processRunner.recordedCalls, contains( - ProcessCall( - getFlutterCommand(mockPlatform), - const ['pub', 'get'], - testRoot.childDirectory(allPackagesProjectName).path, - ), + ProcessCall(getFlutterCommand(mockPlatform), const [ + 'pub', + 'get', + ], testRoot.childDirectory(allPackagesProjectName).path), ), ); }); diff --git a/script/tool/test/fetch_deps_command_test.dart b/script/tool/test/fetch_deps_command_test.dart index 4a5bae11e8d4..a496116aca33 100644 --- a/script/tool/test/fetch_deps_command_test.dart +++ b/script/tool/test/fetch_deps_command_test.dart @@ -336,11 +336,11 @@ void main() { expect( processRunner.recordedCalls, orderedEquals([ - ProcessCall( - getFlutterCommand(mockPlatform), - const ['build', 'apk', '--config-only'], - plugin.getExamples().first.directory.path, - ), + ProcessCall(getFlutterCommand(mockPlatform), const [ + 'build', + 'apk', + '--config-only', + ], plugin.getExamples().first.directory.path), ProcessCall(androidDir.childFile('gradlew').path, const [ 'plugin1:dependencies', ], androidDir.path), diff --git a/third_party/packages/flutter_svg/README.md b/third_party/packages/flutter_svg/README.md index 2a0d50d2b474..1930832376a6 100644 --- a/third_party/packages/flutter_svg/README.md +++ b/third_party/packages/flutter_svg/README.md @@ -62,6 +62,7 @@ class _MyColorMapper extends ColorMapper { return color; } } + // ··· const svgString = ''' @@ -158,6 +159,7 @@ The output `foo.svg.vec` can be loaded using the default constructor of ```dart import 'package:vector_graphics/vector_graphics.dart'; + // ··· const Widget svg = SvgPicture(AssetBytesLoader('assets/foo.svg.vec')); ``` diff --git a/third_party/packages/flutter_svg/example/lib/readme_excerpts.dart b/third_party/packages/flutter_svg/example/lib/readme_excerpts.dart index 61c91d58fcb3..1cbfef0f9a21 100644 --- a/third_party/packages/flutter_svg/example/lib/readme_excerpts.dart +++ b/third_party/packages/flutter_svg/example/lib/readme_excerpts.dart @@ -14,6 +14,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; // #docregion PrecompiledAsset import 'package:vector_graphics/vector_graphics.dart'; + // #enddocregion PrecompiledAsset /// Loads an SVG asset. @@ -124,6 +125,7 @@ class _MyColorMapper extends ColorMapper { return color; } } + // #enddocregion ColorMapper /// Demonstrates loading an SVG asset with a color mapping.