text
stringlengths
6
13.6M
id
stringlengths
13
176
metadata
dict
__index_level_0__
int64
0
1.69k
# linting_tool A desktop tool that helps you manage [linter rules](https://dart.dev/guides/language/analysis-options#enabling-linter-rules) for your Flutter project. ## Goals for this sample * Show how to read and write files on Desktop * Show how to create, parse and use yaml files * Show how to implement basic nav...
samples/experimental/linting_tool/README.md/0
{ "file_path": "samples/experimental/linting_tool/README.md", "repo_id": "samples", "token_count": 240 }
1,320
// Copyright 2021 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:linting_tool/layout/adaptive.dart'; import 'package:linting_tool/model/editing_controller.dart'; impor...
samples/experimental/linting_tool/lib/pages/saved_lints_page.dart/0
{ "file_path": "samples/experimental/linting_tool/lib/pages/saved_lints_page.dart", "repo_id": "samples", "token_count": 3573 }
1,321
// Copyright 2021 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:hive_flutter/hive_flutter.dart'; i...
samples/experimental/linting_tool/test/widget_test.dart/0
{ "file_path": "samples/experimental/linting_tool/test/widget_test.dart", "repo_id": "samples", "token_count": 1665 }
1,322
/* * Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file * for details. All rights reserved. Use of this source code is governed by a * BSD-style license that can be found in the LICENSE file. */ #include "dart_api_dl.h" /* NOLINT */ #include "dart_version.h" /* NO...
samples/experimental/pedometer/src/dart-sdk/include/dart_api_dl.c/0
{ "file_path": "samples/experimental/pedometer/src/dart-sdk/include/dart_api_dl.c", "repo_id": "samples", "token_count": 876 }
1,323
org.gradle.jvmargs=-Xmx4G android.useAndroidX=true android.enableJetifier=true
samples/experimental/varfont_shader_puzzle/android/gradle.properties/0
{ "file_path": "samples/experimental/varfont_shader_puzzle/android/gradle.properties", "repo_id": "samples", "token_count": 30 }
1,324
// Copyright 2023 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'dart:math'; import 'package:flutter/material.dart'; import '../components/components.dart'; import '../page_content/pages_flow.dart'; import '../sty...
samples/experimental/varfont_shader_puzzle/lib/page_content/page_optical_size.dart/0
{ "file_path": "samples/experimental/varfont_shader_puzzle/lib/page_content/page_optical_size.dart", "repo_id": "samples", "token_count": 2890 }
1,325
// Copyright 2023 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #define PI 3.1415926538 uniform float uTime; uniform vec2 uSize; uniform float uDampener; out vec4 fragColor; uniform sampler2D uTexture; void main() { ...
samples/experimental/varfont_shader_puzzle/shaders/nothing.frag/0
{ "file_path": "samples/experimental/varfont_shader_puzzle/shaders/nothing.frag", "repo_id": "samples", "token_count": 154 }
1,326
// Copyright 2020, the Flutter project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. // GENERATED CODE - DO NOT MODIFY BY HAND part of 'api.dart'; // **************************************...
samples/experimental/web_dashboard/lib/src/api/api.g.dart/0
{ "file_path": "samples/experimental/web_dashboard/lib/src/api/api.g.dart", "repo_id": "samples", "token_count": 306 }
1,327
// Copyright 2020, the Flutter project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:web_dash...
samples/experimental/web_dashboard/lib/src/widgets/dialogs.dart/0
{ "file_path": "samples/experimental/web_dashboard/lib/src/widgets/dialogs.dart", "repo_id": "samples", "token_count": 937 }
1,328
# Run with tooling from https://github.com/flutter/codelabs/tree/main/tooling/codelab_rebuild name: Flutter Maps Firestore rebuild script steps: - name: Remove the runner rmdirs: - ios - name: Recreate runner flutter: create --platforms ios . - name: Create GoogleService-Info.plist path: ios/Go...
samples/flutter_maps_firestore/codelab_rebuild.yaml/0
{ "file_path": "samples/flutter_maps_firestore/codelab_rebuild.yaml", "repo_id": "samples", "token_count": 1798 }
1,329
import UIKit import Flutter import GoogleMaps @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { // TODO: Replace this with an API key t...
samples/flutter_maps_firestore/ios/Runner/AppDelegate.swift/0
{ "file_path": "samples/flutter_maps_firestore/ios/Runner/AppDelegate.swift", "repo_id": "samples", "token_count": 210 }
1,330
// Copyright 2020, the Flutter project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import 'package:flutter/material.dart'; // Demonstrates how to use autofill hints. The full list of hint...
samples/form_app/lib/src/autofill.dart/0
{ "file_path": "samples/form_app/lib/src/autofill.dart", "repo_id": "samples", "token_count": 2728 }
1,331
// Copyright 2022, the Flutter project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import 'package:flutter/foundation.dart'; /// An extremely silly example of a game state. /// /// Tracks...
samples/game_template/lib/src/game_internals/level_state.dart/0
{ "file_path": "samples/game_template/lib/src/game_internals/level_state.dart", "repo_id": "samples", "token_count": 233 }
1,332
// Copyright 2022, the Flutter project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. /// An interface of persistence stores for settings. /// /// Implementations can range from simple in-mem...
samples/game_template/lib/src/settings/persistence/settings_persistence.dart/0
{ "file_path": "samples/game_template/lib/src/settings/persistence/settings_persistence.dart", "repo_id": "samples", "token_count": 195 }
1,333
// Copyright 2022, the Flutter project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import 'package:flutter_test/flutter_test.dart'; import 'package:game_template/main.dart'; import 'packag...
samples/game_template/test/smoke_test.dart/0
{ "file_path": "samples/game_template/test/smoke_test.dart", "repo_id": "samples", "token_count": 572 }
1,334
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.google_maps_in_flutter"> <!-- The INTERNET permission is required for development. Specifically, the Flutter tool needs it to communicate with the running application to allow setting breakpoints, to prov...
samples/google_maps/android/app/src/debug/AndroidManifest.xml/0
{ "file_path": "samples/google_maps/android/app/src/debug/AndroidManifest.xml", "repo_id": "samples", "token_count": 135 }
1,335
include: package:analysis_defaults/flutter.yaml
samples/ios_app_clip/analysis_options.yaml/0
{ "file_path": "samples/ios_app_clip/analysis_options.yaml", "repo_id": "samples", "token_count": 15 }
1,336
# Isolate Example A sample application that demonstrate best practices when using [`isolates`](https://api.dartlang.org/stable/2.3.1/dart-isolate/Isolate-class.html). ## Goals * Display the performance benefits of isolates when using them in the right situation. * Show how to use the `compute` method for straightfor...
samples/isolate_example/README.md/0
{ "file_path": "samples/isolate_example/README.md", "repo_id": "samples", "token_count": 524 }
1,337
// Copyright 2019-present the Flutter authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required ...
samples/isolate_example/lib/main.dart/0
{ "file_path": "samples/isolate_example/lib/main.dart", "repo_id": "samples", "token_count": 999 }
1,338
#include "../../Flutter/Flutter-Debug.xcconfig" #include "Warnings.xcconfig"
samples/isolate_example/macos/Runner/Configs/Debug.xcconfig/0
{ "file_path": "samples/isolate_example/macos/Runner/Configs/Debug.xcconfig", "repo_id": "samples", "token_count": 32 }
1,339
include: package:analysis_defaults/flutter.yaml
samples/material_3_demo/analysis_options.yaml/0
{ "file_path": "samples/material_3_demo/analysis_options.yaml", "repo_id": "samples", "token_count": 15 }
1,340
// Copyright 2021 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'package:flutter/material.dart'; class ElevationScreen extends StatelessWidget { const ElevationScreen({super.key}); @override Widget build(Bui...
samples/material_3_demo/lib/elevation_screen.dart/0
{ "file_path": "samples/material_3_demo/lib/elevation_screen.dart", "repo_id": "samples", "token_count": 2619 }
1,341
package dev.flutter.navigation_and_routing import io.flutter.embedding.android.FlutterActivity class MainActivity: FlutterActivity() { }
samples/navigation_and_routing/android/app/src/main/kotlin/dev/flutter/navigation_and_routing/MainActivity.kt/0
{ "file_path": "samples/navigation_and_routing/android/app/src/main/kotlin/dev/flutter/navigation_and_routing/MainActivity.kt", "repo_id": "samples", "token_count": 43 }
1,342
// Copyright 2021, the Flutter project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import '../data/author.dart'; import '../data/library.dart'; imp...
samples/navigation_and_routing/lib/src/screens/authors.dart/0
{ "file_path": "samples/navigation_and_routing/lib/src/screens/authors.dart", "repo_id": "samples", "token_count": 294 }
1,343
// Copyright 2021, the Flutter project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import 'package:bookstore/src/data/library.dart'; import 'package:test/test.dart'; void main() { group...
samples/navigation_and_routing/test/library_test.dart/0
{ "file_path": "samples/navigation_and_routing/test/library_test.dart", "repo_id": "samples", "token_count": 535 }
1,344
plugins { id "com.android.application" id "kotlin-android" id "dev.flutter.flutter-gradle-plugin" } def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> local...
samples/place_tracker/android/app/build.gradle/0
{ "file_path": "samples/place_tracker/android/app/build.gradle", "repo_id": "samples", "token_count": 676 }
1,345
// Copyright 2020 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'package:google_maps_flutter/google_maps_flutter.dart'; class Place { final String id; final LatLng latLng; final String name; final PlaceCate...
samples/place_tracker/lib/place.dart/0
{ "file_path": "samples/place_tracker/lib/place.dart", "repo_id": "samples", "token_count": 652 }
1,346
// Copyright 2020 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:platform_channels/main.dart'; void main() { group(...
samples/platform_channels/test/home_page_test.dart/0
{ "file_path": "samples/platform_channels/test/home_page_test.dart", "repo_id": "samples", "token_count": 194 }
1,347
// Copyright 2018, the Flutter project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; vo...
samples/platform_view_swift/lib/main.dart/0
{ "file_path": "samples/platform_view_swift/lib/main.dart", "repo_id": "samples", "token_count": 1204 }
1,348
#import "GeneratedPluginRegistrant.h"
samples/provider_counter/ios/Runner/Runner-Bridging-Header.h/0
{ "file_path": "samples/provider_counter/ios/Runner/Runner-Bridging-Header.h", "repo_id": "samples", "token_count": 13 }
1,349
#include "../../Flutter/Flutter-Debug.xcconfig" #include "Warnings.xcconfig"
samples/simplistic_calculator/macos/Runner/Configs/Debug.xcconfig/0
{ "file_path": "samples/simplistic_calculator/macos/Runner/Configs/Debug.xcconfig", "repo_id": "samples", "token_count": 32 }
1,350
// Copyright 2020 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; import 'pack...
samples/testing_app/integration_test/app_test.dart/0
{ "file_path": "samples/testing_app/integration_test/app_test.dart", "repo_id": "samples", "token_count": 1205 }
1,351
// Copyright 2020 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:provider/provider.dart'; import 'package:testing_app/models...
samples/testing_app/lib/screens/home.dart/0
{ "file_path": "samples/testing_app/lib/screens/home.dart", "repo_id": "samples", "token_count": 1108 }
1,352
#include "../../Flutter/Flutter-Release.xcconfig" #include "Warnings.xcconfig"
samples/testing_app/macos/Runner/Configs/Release.xcconfig/0
{ "file_path": "samples/testing_app/macos/Runner/Configs/Release.xcconfig", "repo_id": "samples", "token_count": 32 }
1,353
// Copyright 2018 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'package:flutter/cupertino.dart'; import 'package:go_router/go_router.dart'; import 'package:provider/provider.dart'; import 'package:veggieseasons/dat...
samples/veggieseasons/lib/screens/settings.dart/0
{ "file_path": "samples/veggieseasons/lib/screens/settings.dart", "repo_id": "samples", "token_count": 4464 }
1,354
#include "../../Flutter/Flutter-Release.xcconfig" #include "Warnings.xcconfig"
samples/veggieseasons/macos/Runner/Configs/Release.xcconfig/0
{ "file_path": "samples/veggieseasons/macos/Runner/Configs/Release.xcconfig", "repo_id": "samples", "token_count": 32 }
1,355
// Copyright 2021 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'package:flutter/foundation.dart'; // Base class for the web (real) implementation and dart:io (stub) // implementation. abstract class WebStartupAnal...
samples/web/_packages/web_startup_analyzer/lib/src/web_startup_analyzer_base.dart/0
{ "file_path": "samples/web/_packages/web_startup_analyzer/lib/src/web_startup_analyzer_base.dart", "repo_id": "samples", "token_count": 250 }
1,356
// Copyright 2020 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'dart:convert'; import 'data.dart'; import 'util.dart' as util; String _escapeAttribute(String s) => const HtmlEscape(HtmlEscapeMode.attribute).co...
samples/web/samples_index/lib/src/templates.dart/0
{ "file_path": "samples/web/samples_index/lib/src/templates.dart", "repo_id": "samples", "token_count": 3357 }
1,357
# web_embedding This directory contains examples of how to embed Flutter in web apps (without iframes): * **element_embedding_demo**: Modifies the index.html of a flutter app so it is launched in a custom `hostElement`. This is the most basic embedding example. * **ng-flutter**: A simple Angular app (and component)...
samples/web_embedding/README.md/0
{ "file_path": "samples/web_embedding/README.md", "repo_id": "samples", "token_count": 490 }
1,358
import 'package:flutter/material.dart'; class CounterDemo extends StatefulWidget { final ValueNotifier<int> counter; const CounterDemo({ super.key, required this.counter, }); @override State<CounterDemo> createState() => _CounterDemoState(); } class _CounterDemoState extends State<CounterDemo> { ...
samples/web_embedding/ng-flutter/flutter/lib/pages/counter.dart/0
{ "file_path": "samples/web_embedding/ng-flutter/flutter/lib/pages/counter.dart", "repo_id": "samples", "token_count": 574 }
1,359
import { ChangeDetectorRef, Component } from '@angular/core'; import { NgFlutterComponent } from './ng-flutter/ng-flutter.component'; import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { MatSidenavModule } from '@angular/material/sidenav'; import { CommonModule } from '@angular/common'; impor...
samples/web_embedding/ng-flutter/src/app/app.component.ts/0
{ "file_path": "samples/web_embedding/ng-flutter/src/app/app.component.ts", "repo_id": "samples", "token_count": 2354 }
1,360
targets: $default: sources: include: - examples/** exclude: - '**/.*/**' - '**/android/**' - '**/ios/**' - '**/linux/**' - '**/macos/**' - '**/windows/**' - '**/build/**' - '**/node_modules/**' - '**/*.jar' - '**/c...
website/build.excerpt.yaml/0
{ "file_path": "website/build.excerpt.yaml", "repo_id": "website", "token_count": 238 }
1,361
name: staggered_pic_selection publish_to: none description: A more complex staggered animation example. environment: sdk: ^3.3.0 dependencies: flutter: sdk: flutter dev_dependencies: example_utils: path: ../../example_utils flutter_test: sdk: flutter flutter: uses-material-design: true asset...
website/examples/_animation/staggered_pic_selection/pubspec.yaml/0
{ "file_path": "website/examples/_animation/staggered_pic_selection/pubspec.yaml", "repo_id": "website", "token_count": 448 }
1,362
# Take our settings from the example_utils analysis_options.yaml file. # If necessary for a particular example, this file can also include # overrides for individual lints. include: package:example_utils/analysis.yaml analyzer: errors: # Ignored since ignore_for_files can't be hidden in diff excerpts yet mi...
website/examples/animation/implicit/analysis_options.yaml/0
{ "file_path": "website/examples/animation/implicit/analysis_options.yaml", "repo_id": "website", "token_count": 96 }
1,363
import 'package:flutter/material.dart'; void main() { runApp(const MaterialApp(home: PhysicsCardDragDemo())); } class PhysicsCardDragDemo extends StatelessWidget { const PhysicsCardDragDemo({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(), body: c...
website/examples/cookbook/animation/physics_simulation/lib/step1.dart/0
{ "file_path": "website/examples/cookbook/animation/physics_simulation/lib/step1.dart", "repo_id": "website", "token_count": 455 }
1,364
// ignore_for_file: unused_element, prefer_const_literals_to_create_immutables import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @immutable class ButtonShapeWidget extends StatelessWidget { const ButtonShapeWidget({ super.key, required this.isDownloading, required this.isD...
website/examples/cookbook/effects/download_button/lib/button_taps.dart/0
{ "file_path": "website/examples/cookbook/effects/download_button/lib/button_taps.dart", "repo_id": "website", "token_count": 1602 }
1,365
import 'package:flutter/material.dart'; class SetupFlow extends StatefulWidget { const SetupFlow({ super.key, required this.setupPageRoute, }); final String setupPageRoute; @override State<SetupFlow> createState() => SetupFlowState(); } class SetupFlowState extends State<SetupFlow> { // #docregi...
website/examples/cookbook/effects/nested_nav/lib/setupflow2.dart/0
{ "file_path": "website/examples/cookbook/effects/nested_nav/lib/setupflow2.dart", "repo_id": "website", "token_count": 219 }
1,366
import 'package:flutter/material.dart'; @immutable class FilterSelector extends StatefulWidget { const FilterSelector({ super.key, required this.filters, required this.onFilterChanged, this.padding = const EdgeInsets.symmetric(vertical: 24), }); final List<Color> filters; final void Function(C...
website/examples/cookbook/effects/photo_filter_carousel/lib/excerpt6.dart/0
{ "file_path": "website/examples/cookbook/effects/photo_filter_carousel/lib/excerpt6.dart", "repo_id": "website", "token_count": 1140 }
1,367
// ignore_for_file: unused_field import 'package:flutter/material.dart'; class Menu extends StatefulWidget { const Menu({super.key}); @override State<Menu> createState() => _MenuState(); } // #docregion step3 class _MenuState extends State<Menu> with SingleTickerProviderStateMixin { final List<Interval> _it...
website/examples/cookbook/effects/staggered_menu_animation/lib/step3.dart/0
{ "file_path": "website/examples/cookbook/effects/staggered_menu_animation/lib/step3.dart", "repo_id": "website", "token_count": 756 }
1,368
name: form description: Use Form widget to perform form validation. environment: sdk: ^3.3.0 dependencies: flutter: sdk: flutter dev_dependencies: example_utils: path: ../../../example_utils flutter: uses-material-design: true
website/examples/cookbook/forms/validation/pubspec.yaml/0
{ "file_path": "website/examples/cookbook/forms/validation/pubspec.yaml", "repo_id": "website", "token_count": 89 }
1,369
import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } // MyApp is a StatefulWidget. This allows updating the state of the // widget when an item is removed. class MyApp extends StatefulWidget { const MyApp({super.key}); @override MyAppState createState() { return MyAppState(); ...
website/examples/cookbook/gestures/dismissible/lib/main.dart/0
{ "file_path": "website/examples/cookbook/gestures/dismissible/lib/main.dart", "repo_id": "website", "token_count": 917 }
1,370
import 'package:flutter/material.dart'; import 'package:transparent_image/transparent_image.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { const title = 'Fade in images'; return MaterialApp(...
website/examples/cookbook/images/fading_in_images/lib/memory_main.dart/0
{ "file_path": "website/examples/cookbook/images/fading_in_images/lib/memory_main.dart", "repo_id": "website", "token_count": 418 }
1,371
name: grid_lists description: A new Flutter project. publish_to: none version: 1.0.0+1 environment: sdk: ^3.3.0 dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.6 dev_dependencies: example_utils: path: ../../../example_utils flutter_test: sdk: flutter flutter: uses-material-design...
website/examples/cookbook/lists/grid_lists/pubspec.yaml/0
{ "file_path": "website/examples/cookbook/lists/grid_lists/pubspec.yaml", "repo_id": "website", "token_count": 138 }
1,372
name: error_reporting description: Error reporting example using sentry. publish_to: none environment: sdk: ^3.3.0 dependencies: flutter: sdk: flutter sentry_flutter: ^7.16.0 dev_dependencies: example_utils: path: ../../../example_utils flutter_test: sdk: flutter flutter: uses-material-desig...
website/examples/cookbook/maintenance/error_reporting/pubspec.yaml/0
{ "file_path": "website/examples/cookbook/maintenance/error_reporting/pubspec.yaml", "repo_id": "website", "token_count": 127 }
1,373
import 'package:flutter/material.dart'; class FirstRoute extends StatelessWidget { const FirstRoute({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('First Route'), ), body: Center( child: ElevatedButton( ...
website/examples/cookbook/navigation/navigation_basics/lib/main_step2.dart/0
{ "file_path": "website/examples/cookbook/navigation/navigation_basics/lib/main_step2.dart", "repo_id": "website", "token_count": 605 }
1,374
import 'dart:async'; import 'package:http/http.dart' as http; // #docregion fetchPhotos Future<http.Response> fetchPhotos(http.Client client) async { return client.get(Uri.parse('https://jsonplaceholder.typicode.com/photos')); } // #enddocregion fetchPhotos
website/examples/cookbook/networking/background_parsing/lib/main_step2.dart/0
{ "file_path": "website/examples/cookbook/networking/background_parsing/lib/main_step2.dart", "repo_id": "website", "token_count": 87 }
1,375
import 'dart:async'; import 'dart:convert'; import 'package:flutter/material.dart'; // #docregion Http import 'package:http/http.dart' as http; // #enddocregion Http // #docregion fetchAlbum Future<Album> fetchAlbum() async { final response = await http.get( Uri.parse('https://jsonplaceholder.typicode.com/album...
website/examples/cookbook/networking/update_data/lib/main.dart/0
{ "file_path": "website/examples/cookbook/networking/update_data/lib/main.dart", "repo_id": "website", "token_count": 1850 }
1,376
import 'dart:async'; import 'package:flutter/material.dart'; import 'package:video_player/video_player.dart'; void main() => runApp(const VideoPlayerApp()); class VideoPlayerApp extends StatelessWidget { const VideoPlayerApp({super.key}); @override Widget build(BuildContext context) { return const Materia...
website/examples/cookbook/plugins/play_video/lib/main.dart/0
{ "file_path": "website/examples/cookbook/plugins/play_video/lib/main.dart", "repo_id": "website", "token_count": 1305 }
1,377
name: counter_app description: Flutter project for unit testing introduction. publish_to: none version: 1.0.0+1 environment: sdk: ^3.3.0 dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.6 test: ^1.24.9 dev_dependencies: example_utils: path: ../../../../example_utils flutter: uses-mater...
website/examples/cookbook/testing/unit/counter_app/pubspec.yaml/0
{ "file_path": "website/examples/cookbook/testing/unit/counter_app/pubspec.yaml", "repo_id": "website", "token_count": 134 }
1,378
import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; // #docregion main void main() { testWidgets('MyWidget has a title and message', (tester) async { await tester.pumpWidget(const MyWidget(title: 'T', message: 'M')); final titleFinder = find.text('T'); final messageFi...
website/examples/cookbook/testing/widget/introduction/test/main_step6_test.dart/0
{ "file_path": "website/examples/cookbook/testing/widget/introduction/test/main_step6_test.dart", "repo_id": "website", "token_count": 400 }
1,379
// Copyright 2021 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'dart:convert'; import 'dart:isolate'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; void main() => runApp(const My...
website/examples/development/concurrency/isolates/lib/main.dart/0
{ "file_path": "website/examples/development/concurrency/isolates/lib/main.dart", "repo_id": "website", "token_count": 686 }
1,380
// #docregion DynamicLibrary import 'dart:ffi'; // For FFI import 'dart:io'; // For Platform.isX final DynamicLibrary nativeAddLib = Platform.isAndroid ? DynamicLibrary.open('libnative_add.so') : DynamicLibrary.process(); // #enddocregion DynamicLibrary // #docregion NativeAdd final int Function(int x, int y)...
website/examples/development/platform_integration/lib/c_interop.dart/0
{ "file_path": "website/examples/development/platform_integration/lib/c_interop.dart", "repo_id": "website", "token_count": 150 }
1,381
// ignore_for_file: avoid_print, prefer_const_declarations, prefer_const_constructors // #docregion Build import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return Gesture...
website/examples/development/tools/lib/hot-reload/before.dart/0
{ "file_path": "website/examples/development/tools/lib/hot-reload/before.dart", "repo_id": "website", "token_count": 475 }
1,382
import 'package:flutter/material.dart'; class WelcomeScreen extends StatelessWidget { const WelcomeScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Text( 'Welcome!', style: Theme.of(context).textTheme.displayMedium, ...
website/examples/get-started/codelab_web/lib/step3.dart/0
{ "file_path": "website/examples/get-started/codelab_web/lib/step3.dart", "repo_id": "website", "token_count": 2326 }
1,383
import 'package:flutter/widgets.dart'; class LifecycleWatcher extends StatefulWidget { const LifecycleWatcher({super.key}); @override State<LifecycleWatcher> createState() => _LifecycleWatcherState(); } class _LifecycleWatcherState extends State<LifecycleWatcher> with WidgetsBindingObserver { AppLifecycl...
website/examples/get-started/flutter-for/android_devs/lib/lifecycle.dart/0
{ "file_path": "website/examples/get-started/flutter-for/android_devs/lib/lifecycle.dart", "repo_id": "website", "token_count": 426 }
1,384
import 'package:flutter/material.dart'; class MyWidget extends StatelessWidget { const MyWidget({super.key}); @override Widget build(BuildContext context) { return const Image( image: // #docregion AssetImage AssetImage('images/a_dot_burr.jpeg') // #enddocregion Asset...
website/examples/get-started/flutter-for/ios_devs/lib/images.dart/0
{ "file_path": "website/examples/get-started/flutter-for/ios_devs/lib/images.dart", "repo_id": "website", "token_count": 219 }
1,385
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return const CupertinoApp( home: HomePage(), ); } } class Hom...
website/examples/get-started/flutter-for/ios_devs/lib/row.dart/0
{ "file_path": "website/examples/get-started/flutter-for/ios_devs/lib/row.dart", "repo_id": "website", "token_count": 340 }
1,386
import 'package:flutter/material.dart'; // #docregion CreateState class MyStatefulWidget extends StatefulWidget { const MyStatefulWidget({ super.key, required this.title, }); final String title; @override State<MyStatefulWidget> createState() => _MyStatefulWidgetState(); } class _MyStatefulWidgetSt...
website/examples/get-started/flutter-for/react_native_devs/lib/best_practices.dart/0
{ "file_path": "website/examples/get-started/flutter-for/react_native_devs/lib/best_practices.dart", "repo_id": "website", "token_count": 275 }
1,387
import 'dart:developer' as developer; import 'package:flutter/material.dart'; void main() { runApp(const SampleApp()); } class SampleApp extends StatelessWidget { /// This widget is the root of your application. const SampleApp({super.key}); @override Widget build(BuildContext context) { return const M...
website/examples/get-started/flutter-for/xamarin_devs/lib/listview_builder.dart/0
{ "file_path": "website/examples/get-started/flutter-for/xamarin_devs/lib/listview_builder.dart", "repo_id": "website", "token_count": 562 }
1,388
The samples in this folder used to be under `src/_includes/code`. Despite that, the sources were not being included anywhere. It is likely that the sources appear in some pages none-the-less. What needs to be done is the following: - Each app/sample needs to be fully reviewed (and potentially simplified). - If the sou...
website/examples/internationalization/README.md/0
{ "file_path": "website/examples/internationalization/README.md", "repo_id": "website", "token_count": 161 }
1,389
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart // This is a library that looks up messages for specific locales by // delegating to the appropriate library. export 'messages_all_locales.dart' show initializeMessages;
website/examples/internationalization/intl_example/lib/l10n/messages_all.dart/0
{ "file_path": "website/examples/internationalization/intl_example/lib/l10n/messages_all.dart", "repo_id": "website", "token_count": 68 }
1,390
// Copyright 2021 The Flutter team. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @override...
website/examples/layout/base/lib/main_starter.dart/0
{ "file_path": "website/examples/layout/base/lib/main_starter.dart", "repo_id": "website", "token_count": 237 }
1,391
import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); // #docregion TextAdd class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { // #enddocregion TextAdd const String appTitle = 'Flutter layout demo'; return MaterialApp( ...
website/examples/layout/lakes/step4/lib/main.dart/0
{ "file_path": "website/examples/layout/lakes/step4/lib/main.dart", "repo_id": "website", "token_count": 2297 }
1,392
// #docregion Main import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: A...
website/examples/resources/architectural_overview/lib/main.dart/0
{ "file_path": "website/examples/resources/architectural_overview/lib/main.dart", "repo_id": "website", "token_count": 1041 }
1,393
import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:provider/provider.dart'; import 'package:state_mgmt/main.dart'; import 'package:state_mgmt/src/provider.dart'; void main() { testWidgets('smoke test', (tester) async { // Build our app and trigger a frame. ...
website/examples/state_mgmt/simple/test/widget_test.dart/0
{ "file_path": "website/examples/state_mgmt/simple/test/widget_test.dart", "repo_id": "website", "token_count": 428 }
1,394
name: code_debugging description: Examples to illustrate debugging your Flutter code. publish_to: none environment: sdk: ^3.3.0 dependencies: flutter: sdk: flutter dev_dependencies: example_utils: path: ../../example_utils integration_test: sdk: flutter flutter_test: sdk: flutter flutter:...
website/examples/testing/code_debugging/pubspec.yaml/0
{ "file_path": "website/examples/testing/code_debugging/pubspec.yaml", "repo_id": "website", "token_count": 130 }
1,395
// ignore_for_file: directives_ordering import './my_app.dart'; // #docregion Main import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; void main() { FlutterError.onError = (details) { FlutterError.presentError(details); if (kReleaseMode) exit(1); }; runA...
website/examples/testing/errors/lib/quit_immediate.dart/0
{ "file_path": "website/examples/testing/errors/lib/quit_immediate.dart", "repo_id": "website", "token_count": 144 }
1,396
import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); static const String _title = 'Focus Sample'; @override Widget build(BuildContext context) { return MaterialApp( title: _title, home: Scaffold( ...
website/examples/ui/advanced/focus/lib/custom_control_example.dart/0
{ "file_path": "website/examples/ui/advanced/focus/lib/custom_control_example.dart", "repo_id": "website", "token_count": 534 }
1,397
import 'package:flutter/material.dart'; import '../global/device_type.dart'; import '../widgets/scroll_view_with_scrollbars.dart'; class AdaptiveDataTablePage extends StatelessWidget { AdaptiveDataTablePage({super.key}); final List<int> items = List.generate(100, (index) => index); @override Widget build(Bu...
website/examples/ui/layout/adaptive_app_demos/lib/pages/adaptive_data_table_page.dart/0
{ "file_path": "website/examples/ui/layout/adaptive_app_demos/lib/pages/adaptive_data_table_page.dart", "repo_id": "website", "token_count": 1159 }
1,398
import 'package:flutter/material.dart'; class MyButton extends StatelessWidget { const MyButton({super.key}); @override Widget build(BuildContext context) { return GestureDetector( onTap: () { print('MyButton was tapped!'); }, child: Container( height: 50, padding: ...
website/examples/ui/widgets_intro/lib/main_mybutton.dart/0
{ "file_path": "website/examples/ui/widgets_intro/lib/main_mybutton.dart", "repo_id": "website", "token_count": 363 }
1,399
--- title: Page not found description: Page not found layout: landing body_class: landing-page not-found permalink: /404.html --- <div class="not-found__wrapper"> <h1>404</h1> <p>Sorry, we couldn't find that page…</p> <img src='/assets/images/404/dash_nest.png' class='not-found__illo' alt="Dash pointing you in t...
website/src/404.html/0
{ "file_path": "website/src/404.html", "repo_id": "website", "token_count": 385 }
1,400
{% assign platform = include.platform -%} {% assign caption = include.caption | default: platform -%} {% assign alt = include.alt | default: caption -%} {% assign image = include.image -%} {% if include.width -%} {% assign width = 'width: ' | append: include.width | append: ';' -%} {% else -%} {% assign width = '' -%} ...
website/src/_includes/docs/app-figure.liquid/0
{ "file_path": "website/src/_includes/docs/app-figure.liquid", "repo_id": "website", "token_count": 528 }
1,401
#### Build the Windows version of the Flutter app in PowerShell or the Command Prompt To generate the needed Windows platform dependencies, run the `flutter build` command. ```terminal C:\> flutter build windows --debug ``` ```terminal Building Windows application... 31.4s √ Built...
website/src/_includes/docs/debug/debug-flow-windows.md/0
{ "file_path": "website/src/_includes/docs/debug/debug-flow-windows.md", "repo_id": "website", "token_count": 1949 }
1,402
{% assign doctor = site.data.doctor %} {% assign config = site.data.doctor[include.config] %} {% case include.devos %} {% when 'macOS' %} {% assign displayos = 'macOS 14.4.0 23E214 darwin-arm64' %} {% when 'Windows' %} {% assign displayos = 'Microsoft Windows 11 [Version 10.0.22621.3155]' %} {% when 'Linux' %} {% assig...
website/src/_includes/docs/install/flutter-doctor-success.md/0
{ "file_path": "website/src/_includes/docs/install/flutter-doctor-success.md", "repo_id": "website", "token_count": 829 }
1,403
{% assign terminal=include.terminal %} {% assign target = include.target %} {% assign dir = include.dir %} ### Add Flutter to your `PATH` {:.no_toc} To run Flutter commands in {{terminal}}, add Flutter to the `PATH` environment variable. This guide presumes your [Mac runs the latest default shell][zsh-mac], `zsh`. Zs...
website/src/_includes/docs/install/reqs/macos/set-path.md/0
{ "file_path": "website/src/_includes/docs/install/reqs/macos/set-path.md", "repo_id": "website", "token_count": 361 }
1,404
<div class="tab-pane active" id="vscode" role="tabpanel" aria-labelledby="vscode-tab" markdown="1"> ### Create your sample Flutter app {#create-app} 1. Open the Command Palette. Go to **View** <span aria-label="and then">></span> **Command Palette** or press <kbd>{{special}}</kbd> + <kbd>Shift</kbd> + <kbd>P</...
website/src/_includes/docs/install/test-drive/vscode.md/0
{ "file_path": "website/src/_includes/docs/install/test-drive/vscode.md", "repo_id": "website", "token_count": 708 }
1,405
{% for entry in include.children -%} {% if include.active_entries and forloop.index == include.active_entries[1] -%} {% assign isActive = true -%} {% assign class = 'nav-link active' -%} {% else -%} {% assign isActive = false -%} {% assign class = 'nav-link' -%} {% endif -%} {% if entry == 'divider' -%} <d...
website/src/_includes/sidenav-level-2.html/0
{ "file_path": "website/src/_includes/sidenav-level-2.html", "repo_id": "website", "token_count": 809 }
1,406
## ## Classes that support the processing of <?code-excerpt?> and ## <?code-pane?> instructions. ## require 'active_support' require 'active_support/isolated_execution_state' require 'active_support/core_ext/string' require 'open3' require 'nokogiri' require 'yaml' require_relative 'code_diff_core' require_relative 'd...
website/src/_plugins/code_excerpt_processor.rb/0
{ "file_path": "website/src/_plugins/code_excerpt_processor.rb", "repo_id": "website", "token_count": 4394 }
1,407
@use '../vendor/bootstrap'; .book-img-with-details { margin-bottom: 1.5rem; img { @include bootstrap.media-breakpoint-down(sm) { max-width: 200px; } width: 100%; } .details { .title { @include bootstrap.media-breakpoint-up(sm) { margin-top: 0; } margin-bottom: 0; } } }
website/src/_sass/components/_books.scss/0
{ "file_path": "website/src/_sass/components/_books.scss", "repo_id": "website", "token_count": 137 }
1,408
/** * @license * Copyright (C) 2015 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable...
website/src/_sass/vendor/_prettify.scss/0
{ "file_path": "website/src/_sass/vendor/_prettify.scss", "repo_id": "website", "token_count": 747 }
1,409
<?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 27.7.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="448px" height="512px" viewBox="0 0 448 512" style="...
website/src/assets/images/docs/brand-svg/linux.svg/0
{ "file_path": "website/src/assets/images/docs/brand-svg/linux.svg", "repo_id": "website", "token_count": 3513 }
1,410
function setupTabs(container, storageName, defaultTabGetter) { const tabs = $(container).find('li a'); function getTabIdFromQuery(query) { const match = query.match(/(#|\btab=)([\w-]+)/); return match ? match[2] : ''; } function clickHandler(e) { e.preventDefault(); $(this).tab('show'); co...
website/src/assets/js/tabs.js/0
{ "file_path": "website/src/assets/js/tabs.js", "repo_id": "website", "token_count": 526 }
1,411
--- title: Add a drawer to a screen description: How to implement a Material Drawer. js: - defer: true url: https://old-dartpad-3ce3f.web.app/inject_embed.dart.js --- <?code-excerpt path-base="cookbook/design/drawer"?> In apps that use Material Design, there are two primary options for navigation: tabs and draw...
website/src/cookbook/design/drawer.md/0
{ "file_path": "website/src/cookbook/design/drawer.md", "repo_id": "website", "token_count": 3005 }
1,412
--- title: Create a shimmer loading effect description: How to implement a shimmer loading effect. js: - defer: true url: https://old-dartpad-3ce3f.web.app/inject_embed.dart.js --- <?code-excerpt path-base="cookbook/effects/shimmer_loading"?> Loading times are unavoidable in application development. From a user...
website/src/cookbook/effects/shimmer-loading.md/0
{ "file_path": "website/src/cookbook/effects/shimmer-loading.md", "repo_id": "website", "token_count": 9658 }
1,413
--- title: Fade in images with a placeholder description: How to fade images into view. --- <?code-excerpt path-base="cookbook/images/fading_in_images"?> When displaying images using the default `Image` widget, you might notice they simply pop onto the screen as they're loaded. This might feel visually jarring to you...
website/src/cookbook/images/fading-in-images.md/0
{ "file_path": "website/src/cookbook/images/fading-in-images.md", "repo_id": "website", "token_count": 1348 }
1,414
--- title: Animate a widget across screens description: How to animate a widget from one screen to another js: - defer: true url: https://old-dartpad-3ce3f.web.app/inject_embed.dart.js --- <?code-excerpt path-base="cookbook/navigation/hero_animations"?> It's often helpful to guide users through an app as they n...
website/src/cookbook/navigation/hero-animations.md/0
{ "file_path": "website/src/cookbook/navigation/hero-animations.md", "repo_id": "website", "token_count": 2094 }
1,415
--- title: Communicate with WebSockets description: How to connect to a web socket. --- <?code-excerpt path-base="cookbook/networking/web_sockets/"?> In addition to normal HTTP requests, you can connect to servers using `WebSockets`. `WebSockets` allow for two-way communication with a server without polling. In this...
website/src/cookbook/networking/web-sockets.md/0
{ "file_path": "website/src/cookbook/networking/web-sockets.md", "repo_id": "website", "token_count": 1989 }
1,416
--- title: Find widgets description: How to use the Finder classes for testing widgets. --- <?code-excerpt path-base="cookbook/testing/widget/finders/"?> {% assign api = site.api | append: '/flutter' -%} To locate widgets in a test environment, use the [`Finder`][] classes. While it's possible to write your own `Fin...
website/src/cookbook/testing/widget/finders.md/0
{ "file_path": "website/src/cookbook/testing/widget/finders.md", "repo_id": "website", "token_count": 1581 }
1,417
--- title: State management description: How to structure an app to manage the state of the data flowing through it. next: title: Start thinking declaratively path: /development/data-and-backend/state-mgmt/declarative --- {{site.alert.note}} If you have written a mobile app using Flutter and wonder why your ap...
website/src/data-and-backend/state-mgmt/intro.md/0
{ "file_path": "website/src/data-and-backend/state-mgmt/intro.md", "repo_id": "website", "token_count": 410 }
1,418
--- title: Write your first Flutter app on the web description: How to create a Flutter web app. short-title: Write your first web app js: - defer: true url: https://old-dartpad-3ce3f.web.app/inject_embed.dart.js --- <?code-excerpt path-base="get-started/codelab_web"?> {{site.alert.tip}} This codelab walks yo...
website/src/get-started/codelab-web.md/0
{ "file_path": "website/src/get-started/codelab-web.md", "repo_id": "website", "token_count": 11286 }
1,419