text stringlengths 6 13.6M | id stringlengths 13 176 | metadata dict | __index_level_0__ int64 0 1.69k |
|---|---|---|---|
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// TODO(a14n): remove this import once Flutter 3.1 or later reaches stable (including flutter/flutter#104231)
// ignore: unnecessary_import
import 'dart:ty... | plugins/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart/0 | {
"file_path": "plugins/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart",
"repo_id": "plugins",
"token_count": 3224
} | 1,179 |
name: webview_flutter_wkwebview
description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control.
repository: https://github.com/flutter/plugins/tree/main/packages/webview_flutter/webview_flutter_wkwebview
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+lab... | plugins/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml/0 | {
"file_path": "plugins/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml",
"repo_id": "plugins",
"token_count": 356
} | 1,180 |
// Mocks generated by Mockito 5.3.2 from annotations
// in webview_flutter_wkwebview/test/webkit_webview_controller_test.dart.
// Do not manually edit this file.
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i5;
import 'dart:math' as _i2;
import 'dart:ui' as _i6;
import 'pack... | plugins/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart/0 | {
"file_path": "plugins/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart",
"repo_id": "plugins",
"token_count": 11406
} | 1,181 |
#!/bin/bash
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script may be run as:
# $ CHROME_DOWNLOAD_DIR=./whatever script/install_chromium.sh
set -e
set -x
# The target directory where chromium is... | plugins/script/install_chromium.sh/0 | {
"file_path": "plugins/script/install_chromium.sh",
"repo_id": "plugins",
"token_count": 850
} | 1,182 |
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.flutter.example.androidView">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@... | samples/add_to_app/android_view/android_view/app/src/main/AndroidManifest.xml/0 | {
"file_path": "samples/add_to_app/android_view/android_view/app/src/main/AndroidManifest.xml",
"repo_id": "samples",
"token_count": 361
} | 1,183 |
package dev.flutter.example.books
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing docum... | samples/add_to_app/books/android_books/app/src/androidTest/java/dev/flutter/example/books/ExampleInstrumentedTest.kt/0 | {
"file_path": "samples/add_to_app/books/android_books/app/src/androidTest/java/dev/flutter/example/books/ExampleInstrumentedTest.kt",
"repo_id": "samples",
"token_count": 251
} | 1,184 |
// 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 Flutter
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
lazy var engine: FlutterEngine = {
let result = FlutterEngine... | samples/add_to_app/books/ios_books/IosBooks/AppDelegate.swift/0 | {
"file_path": "samples/add_to_app/books/ios_books/IosBooks/AppDelegate.swift",
"repo_id": "samples",
"token_count": 346
} | 1,185 |
# plugin
Embeds a full screen Flutter instance that is using plugins into an existing iOS
or Android app.
## Description
These apps are similar to the samples in [`fullscreen`](../fullscreen), with the
following differences:
* They include the native code (Kotlin or Swift) required to initialize plugins
at Flutte... | samples/add_to_app/plugin/README.md/0 | {
"file_path": "samples/add_to_app/plugin/README.md",
"repo_id": "samples",
"token_count": 379
} | 1,186 |
// Copyright 2019 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 AnimatedBuilderDemo extends StatefulWidget {
const AnimatedBuilderDemo({super.key});
static const String ro... | samples/animations/lib/src/basics/animated_builder.dart/0 | {
"file_path": "samples/animations/lib/src/basics/animated_builder.dart",
"repo_id": "samples",
"token_count": 1004
} | 1,187 |
// 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 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
// Demonstrating the `flutter_animate` package
class FlutterAn... | samples/animations/lib/src/misc/flutter_animate.dart/0 | {
"file_path": "samples/animations/lib/src/misc/flutter_animate.dart",
"repo_id": "samples",
"token_count": 600
} | 1,188 |
// 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:animations/src/misc/card_swipe.dart';
import 'package:flutter/material.dart' hide Card;
import 'package:flutter_test/flutter_test.dart';
Widg... | samples/animations/test/misc/card_swipe_test.dart/0 | {
"file_path": "samples/animations/test/misc/card_swipe_test.dart",
"repo_id": "samples",
"token_count": 854
} | 1,189 |
// Copyright 2022 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' show Directory;
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:path/path.dart' as path;
import 'pa... | samples/background_isolate_channels/lib/main.dart/0 | {
"file_path": "samples/background_isolate_channels/lib/main.dart",
"repo_id": "samples",
"token_count": 1749
} | 1,190 |
#include "Generated.xcconfig"
| samples/code_sharing/client/ios/Flutter/Release.xcconfig/0 | {
"file_path": "samples/code_sharing/client/ios/Flutter/Release.xcconfig",
"repo_id": "samples",
"token_count": 12
} | 1,191 |
#include "ephemeral/Flutter-Generated.xcconfig"
| samples/code_sharing/client/macos/Flutter/Flutter-Release.xcconfig/0 | {
"file_path": "samples/code_sharing/client/macos/Flutter/Flutter-Release.xcconfig",
"repo_id": "samples",
"token_count": 19
} | 1,192 |
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
For genera... | samples/code_sharing/shared/README.md/0 | {
"file_path": "samples/code_sharing/shared/README.md",
"repo_id": "samples",
"token_count": 336
} | 1,193 |
package com.example.context_menus
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
| samples/context_menus/android/app/src/main/kotlin/com/example/context_menus/MainActivity.kt/0 | {
"file_path": "samples/context_menus/android/app/src/main/kotlin/com/example/context_menus/MainActivity.kt",
"repo_id": "samples",
"token_count": 39
} | 1,194 |
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'constants.dart';
import 'context_menu_region.dart';
import 'is_valid_email.dart';
import 'platform_selector.dart';
class FullPage extends StatelessWidget {
FullPage({
super.k... | samples/context_menus/lib/full_page.dart/0 | {
"file_path": "samples/context_menus/lib/full_page.dart",
"repo_id": "samples",
"token_count": 3264
} | 1,195 |
#include "Generated.xcconfig"
| samples/deeplink_store_example/ios/Flutter/Release.xcconfig/0 | {
"file_path": "samples/deeplink_store_example/ios/Flutter/Release.xcconfig",
"repo_id": "samples",
"token_count": 12
} | 1,196 |
// Copyright 2019 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:fluent_ui/fluent_ui.dart';
typedef PhotoSearchDialogCallback = void Function(String searchQuery);
class PhotoSearchDialog extends StatefulWi... | samples/desktop_photo_search/fluent_ui/lib/src/widgets/photo_search_dialog.dart/0 | {
"file_path": "samples/desktop_photo_search/fluent_ui/lib/src/widgets/photo_search_dialog.dart",
"repo_id": "samples",
"token_count": 784
} | 1,197 |
rootProject.name = 'federated_plugin'
| samples/experimental/federated_plugin/federated_plugin/android/settings.gradle/0 | {
"file_path": "samples/experimental/federated_plugin/federated_plugin/android/settings.gradle",
"repo_id": "samples",
"token_count": 13
} | 1,198 |
// 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:federated_plugin_example/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_t... | samples/experimental/federated_plugin/federated_plugin/example/test/widget_test.dart/0 | {
"file_path": "samples/experimental/federated_plugin/federated_plugin/example/test/widget_test.dart",
"repo_id": "samples",
"token_count": 391
} | 1,199 |
// 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:async';
import 'package:federated_plugin_platform_interface/federated_plugin_platform_interface.dart';
/// Returns the current battery level of... | samples/experimental/federated_plugin/federated_plugin/lib/federated_plugin.dart/0 | {
"file_path": "samples/experimental/federated_plugin/federated_plugin/lib/federated_plugin.dart",
"repo_id": "samples",
"token_count": 139
} | 1,200 |
name: federated_plugin_platform_interface
description: A platform interface for federated_plugin.
version: 0.0.1
homepage:
environment:
sdk: ^3.2.0
dependencies:
flutter:
sdk: flutter
plugin_platform_interface: ^2.0.2
dev_dependencies:
analysis_defaults:
path: ../../../analysis_defaults
flutter_tes... | samples/experimental/federated_plugin/federated_plugin_platform_interface/pubspec.yaml/0 | {
"file_path": "samples/experimental/federated_plugin/federated_plugin_platform_interface/pubspec.yaml",
"repo_id": "samples",
"token_count": 127
} | 1,201 |
// 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:equatable/equatable.dart';
import 'package:hive/hive.dart';
import 'package:json_annotation/json_annotation.dart';
part 'rule.g.dart';
@Json... | samples/experimental/linting_tool/lib/model/rule.dart/0 | {
"file_path": "samples/experimental/linting_tool/lib/model/rule.dart",
"repo_id": "samples",
"token_count": 376
} | 1,202 |
// 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:flutter_markdown/flutter_markdown.dart';
import 'package:linting_tool/model/editing_controller.dart';
... | samples/experimental/linting_tool/lib/widgets/saved_rule_tile.dart/0 | {
"file_path": "samples/experimental/linting_tool/lib/widgets/saved_rule_tile.dart",
"repo_id": "samples",
"token_count": 2722
} | 1,203 |
#include "../../Flutter/Flutter-Release.xcconfig"
#include "Warnings.xcconfig"
| samples/experimental/linting_tool/macos/Runner/Configs/Release.xcconfig/0 | {
"file_path": "samples/experimental/linting_tool/macos/Runner/Configs/Release.xcconfig",
"repo_id": "samples",
"token_count": 32
} | 1,204 |
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProje... | samples/experimental/pedometer/example/android/app/build.gradle/0 | {
"file_path": "samples/experimental/pedometer/example/android/app/build.gradle",
"repo_id": "samples",
"token_count": 851
} | 1,205 |
// Autogenerated by jnigen. DO NOT EDIT!
#include <stdint.h>
#include "jni.h"
#include "dartjni.h"
thread_local JNIEnv *jniEnv;
JniContext *jni;
JniContext *(*context_getter)(void);
JNIEnv *(*env_getter)(void);
void setJniGetters(JniContext *(*cg)(void),
JNIEnv *(*eg)(void)) {
context_getter = cg;
e... | samples/experimental/pedometer/src/health_connect/health_connect.c/0 | {
"file_path": "samples/experimental/pedometer/src/health_connect/health_connect.c",
"repo_id": "samples",
"token_count": 202535
} | 1,206 |
// 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';
// WonkyAnimPalette class is meant to be used with WonkyC... | samples/experimental/varfont_shader_puzzle/lib/components/wonky_anim_palette.dart/0 | {
"file_path": "samples/experimental/varfont_shader_puzzle/lib/components/wonky_anim_palette.dart",
"repo_id": "samples",
"token_count": 3221
} | 1,207 |
// 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 'dart:async';
import 'package:flutter/material.dart';
import '../widgets/dialogs.dart';
import '... | samples/experimental/web_dashboard/lib/src/pages/home.dart/0 | {
"file_path": "samples/experimental/web_dashboard/lib/src/pages/home.dart",
"repo_id": "samples",
"token_count": 1365
} | 1,208 |
#import "GeneratedPluginRegistrant.h"
| samples/flutter_maps_firestore/ios/Runner/Runner-Bridging-Header.h/0 | {
"file_path": "samples/flutter_maps_firestore/ios/Runner/Runner-Bridging-Header.h",
"repo_id": "samples",
"token_count": 13
} | 1,209 |
The following template will be deprecated soon. Please refer to the new games repo for more genre-specific templates: https://github.com/flutter/games
For more information, please refer to flutter.dev/games to see all resources available for flutter game developers.
Old template readme:
A starter game in Flutter wit... | samples/game_template/README.md/0 | {
"file_path": "samples/game_template/README.md",
"repo_id": "samples",
"token_count": 6401
} | 1,210 |
// 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';
import 'package:google_mobile_ads/google_mobile_ads.dart';
imp... | samples/game_template/lib/src/ads/ads_controller.dart/0 | {
"file_path": "samples/game_template/lib/src/ads/ads_controller.dart",
"repo_id": "samples",
"token_count": 677
} | 1,211 |
// 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:shared_preferences/shared_preferences.dart';
import 'player_progress_persistence.dart';
... | samples/game_template/lib/src/player_progress/persistence/local_storage_player_progress_persistence.dart/0 | {
"file_path": "samples/game_template/lib/src/player_progress/persistence/local_storage_player_progress_persistence.dart",
"repo_id": "samples",
"token_count": 264
} | 1,212 |
include: package:analysis_defaults/flutter.yaml
| samples/infinite_list/analysis_options.yaml/0 | {
"file_path": "samples/infinite_list/analysis_options.yaml",
"repo_id": "samples",
"token_count": 15
} | 1,213 |
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'item.dart';
const int itemsPerPage = 20;
class ItemPage {
final List<Item> items;
final int startingIndex;
final bool hasNext;
ItemPa... | samples/infinite_list/lib/src/api/page.dart/0 | {
"file_path": "samples/infinite_list/lib/src/api/page.dart",
"repo_id": "samples",
"token_count": 128
} | 1,214 |
// 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 'package:go_router/go_router.dart';
import 'auth.dart';
i... | samples/navigation_and_routing/lib/src/app.dart/0 | {
"file_path": "samples/navigation_and_routing/lib/src/app.dart",
"repo_id": "samples",
"token_count": 6639
} | 1,215 |
// 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.
package dev.flutter.platform_channels
import android.content.Context
import android.hardware.Sensor
import android.hardware.SensorManager
import com.google.g... | samples/platform_channels/android/app/src/main/kotlin/dev/flutter/platform_channels/MainActivity.kt/0 | {
"file_path": "samples/platform_channels/android/app/src/main/kotlin/dev/flutter/platform_channels/MainActivity.kt",
"repo_id": "samples",
"token_count": 1909
} | 1,216 |
# Run with tooling from https://github.com/flutter/codelabs/tree/main/tooling/codelab_rebuild
name: Animations rebuild script
steps:
- name: Remove runners
rmdirs:
- android
- ios
- name: Flutter recreate
flutter: create --platform android,ios --org dev.flutter .
- name: Patch android/app/bui... | samples/platform_channels/codelab_rebuild.yaml/0 | {
"file_path": "samples/platform_channels/codelab_rebuild.yaml",
"repo_id": "samples",
"token_count": 169015
} | 1,217 |
// 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/services.dart';
import 'package:platform_channels/src/accelerometer_event_channel.dart';
/// ... | samples/platform_channels/lib/src/event_channel_demo.dart/0 | {
"file_path": "samples/platform_channels/lib/src/event_channel_demo.dart",
"repo_id": "samples",
"token_count": 845
} | 1,218 |
// 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/cupertino.dart';
import 'package:flutter/material.dart';
import 'widgets.dart';
class SettingsTab extends StatefulWidget {
static ... | samples/platform_design/lib/settings_tab.dart/0 | {
"file_path": "samples/platform_design/lib/settings_tab.dart",
"repo_id": "samples",
"token_count": 1357
} | 1,219 |
# platform_view_swift
A Flutter sample app that combines a native iOS UIViewController
with a full-screen Flutter view.
## Goals for this sample
* Show a simple technique for combining native and Flutter views.
## The important bits
### `lib/main.dart`
The Flutter part of the application is quite simple, and all ... | samples/platform_view_swift/README.md/0 | {
"file_path": "samples/platform_view_swift/README.md",
"repo_id": "samples",
"token_count": 299
} | 1,220 |
name: provider_counter
description: >
The starter Flutter application, but using Provider to manage state.
publish_to: none
version: 1.0.0
environment:
sdk: ^3.2.0
dependencies:
flutter:
sdk: flutter
provider: ^6.0.2
cupertino_icons: ^1.0.3
window_size:
git:
url: https://github.com/google/f... | samples/provider_counter/pubspec.yaml/0 | {
"file_path": "samples/provider_counter/pubspec.yaml",
"repo_id": "samples",
"token_count": 204
} | 1,221 |
// Copyright 2019 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';
/// A proxy of the catalog of items the user can buy.
///
/// In a real app, this might be backed by a backend and ca... | samples/provider_shopper/lib/models/catalog.dart/0 | {
"file_path": "samples/provider_shopper/lib/models/catalog.dart",
"repo_id": "samples",
"token_count": 550
} | 1,222 |
package com.example.simple_shader
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
| samples/simple_shader/android/app/src/main/kotlin/com/example/simple_shader/MainActivity.kt/0 | {
"file_path": "samples/simple_shader/android/app/src/main/kotlin/com/example/simple_shader/MainActivity.kt",
"repo_id": "samples",
"token_count": 39
} | 1,223 |
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:simplistic_calculator/main.dart';
void main() {
testWidgets('Calculator smoke test', (tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(
const ProviderSc... | samples/simplistic_calculator/test/widget_test.dart/0 | {
"file_path": "samples/simplistic_calculator/test/widget_test.dart",
"repo_id": "samples",
"token_count": 448
} | 1,224 |
// 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:provider/provider.dart';
import 'package:testing_app/... | samples/testing_app/test/home_test.dart/0 | {
"file_path": "samples/testing_app/test/home_test.dart",
"repo_id": "samples",
"token_count": 975
} | 1,225 |
#!/bin/bash
set -e
scriptDirectory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# It seems federated_plugin_* isn't happy to run flutter pub upgrade
for dir in `find "${scriptDirectory}/.." -name pubspec.yaml -exec dirname {} \; | grep -v federated_plugin | grep -v experimental | sort`
do
... | samples/tool/flutter_pub_upgrade.sh/0 | {
"file_path": "samples/tool/flutter_pub_upgrade.sh",
"repo_id": "samples",
"token_count": 179
} | 1,226 |
// 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';
enum VeggieCategory {
allium,
berry,
citrus,
cruciferous,
fern,
flower,
fruit,
fungus,
gourd,
le... | samples/veggieseasons/lib/data/veggie.dart/0 | {
"file_path": "samples/veggieseasons/lib/data/veggie.dart",
"repo_id": "samples",
"token_count": 1033
} | 1,227 |
import 'dart:io';
import 'package:path/path.dart' as p;
Future<void> main() async {
await fixBaseTags();
}
/// Changes each sample's `<base href="/">` tag in index.html to
/// `<base href="/samples/web/<SAMPLE_DIR_NAME>/">`
///
/// For example, after building using `build_ci.dart,
/// `../samples_index/public/web/n... | samples/web/_tool/fix_base_tags.dart/0 | {
"file_path": "samples/web/_tool/fix_base_tags.dart",
"repo_id": "samples",
"token_count": 594
} | 1,228 |
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature":... | samples/web_embedding/ng-flutter/tsconfig.json/0 | {
"file_path": "samples/web_embedding/ng-flutter/tsconfig.json",
"repo_id": "samples",
"token_count": 362
} | 1,229 |
source 'https://rubygems.org'
gem 'jekyll', '4.3.3'
gem 'jekyll-sass-converter', '~> 3.0.0'
gem 'webrick'
# Used for custom _plugins
gem 'activesupport', '~> 7.1.3'
gem 'liquid-tag-parser', '~> 2.0.2'
group :jekyll_plugins do
gem 'jekyll-toc', '~> 0.18.0'
end
| website/Gemfile/0 | {
"file_path": "website/Gemfile",
"repo_id": "website",
"token_count": 130
} | 1,230 |
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
// #docregion MaterialApp
return MaterialApp(
title: 'Custom Fonts',
// Set Raleway as the default app... | website/examples/cookbook/design/fonts/lib/main.dart/0 | {
"file_path": "website/examples/cookbook/design/fonts/lib/main.dart",
"repo_id": "website",
"token_count": 388
} | 1,231 |
// ignore_for_file: prefer_const_constructors
import 'package:flutter/material.dart';
class TabBarDemo1 extends StatelessWidget {
const TabBarDemo1({super.key});
@override
Widget build(BuildContext context) {
// #docregion TabController
return MaterialApp(
home: DefaultTabController(
leng... | website/examples/cookbook/design/tabs/lib/partials.dart/0 | {
"file_path": "website/examples/cookbook/design/tabs/lib/partials.dart",
"repo_id": "website",
"token_count": 470
} | 1,232 |
import 'package:flutter/material.dart';
class Shimmer extends StatefulWidget {
static ShimmerState? of(BuildContext context) {
return context.findAncestorStateOfType<ShimmerState>();
}
const Shimmer({
super.key,
required this.linearGradient,
this.child,
});
final LinearGradient linearGradie... | website/examples/cookbook/effects/shimmer_loading/lib/shimmer_state.dart/0 | {
"file_path": "website/examples/cookbook/effects/shimmer_loading/lib/shimmer_state.dart",
"repo_id": "website",
"token_count": 416
} | 1,233 |
name: text_field_changes
description: Sample code for text_field_changes
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/text_field_changes/pubspec.yaml/0 | {
"file_path": "website/examples/cookbook/forms/text_field_changes/pubspec.yaml",
"repo_id": "website",
"token_count": 93
} | 1,234 |
// This file has only enough in it to satisfy `firestore_controller.dart`.
import 'dart:async';
import 'playing_card.dart';
class PlayingArea {
final List<PlayingCard> cards = [];
final StreamController<void> _playerChanges =
StreamController<void>.broadcast();
PlayingArea();
Stream<void> get player... | website/examples/cookbook/games/firestore_multiplayer/lib/game_internals/playing_area.dart/0 | {
"file_path": "website/examples/cookbook/games/firestore_multiplayer/lib/game_internals/playing_area.dart",
"repo_id": "website",
"token_count": 140
} | 1,235 |
name: ripples
description: Example for ripples cookbook recipe
environment:
sdk: ^3.3.0
dependencies:
flutter:
sdk: flutter
dev_dependencies:
example_utils:
path: ../../../example_utils
flutter:
uses-material-design: true
| website/examples/cookbook/gestures/ripples/pubspec.yaml/0 | {
"file_path": "website/examples/cookbook/gestures/ripples/pubspec.yaml",
"repo_id": "website",
"token_count": 89
} | 1,236 |
import 'package:flutter/material.dart';
// ignore_for_file: unused_local_variable
void main() {
runApp(
const MaterialApp(
title: 'Returning Data',
home: HomeScreen(),
),
);
}
// #docregion HomeScreen
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Wi... | website/examples/cookbook/navigation/returning_data/lib/main_step2.dart/0 | {
"file_path": "website/examples/cookbook/navigation/returning_data/lib/main_step2.dart",
"repo_id": "website",
"token_count": 1141
} | 1,237 |
import 'dart:async';
import 'package:http/http.dart' as http;
// #docregion fetchAlbum
Future<http.Response> fetchAlbum() {
return http.get(Uri.parse('https://jsonplaceholder.typicode.com/albums/1'));
}
// #enddocregion fetchAlbum
| website/examples/cookbook/networking/fetch_data/lib/main_step1.dart/0 | {
"file_path": "website/examples/cookbook/networking/fetch_data/lib/main_step1.dart",
"repo_id": "website",
"token_count": 87
} | 1,238 |
import 'package:flutter_test/flutter_test.dart';
import 'package:shared_preferences/shared_preferences.dart';
Future<void> step2() async {
int counter = 0;
// #docregion Step2
// Load and obtain the shared preferences for this app.
final prefs = await SharedPreferences.getInstance();
// Save the counter va... | website/examples/cookbook/persistence/key_value/lib/partial_excerpts.dart/0 | {
"file_path": "website/examples/cookbook/persistence/key_value/lib/partial_excerpts.dart",
"repo_id": "website",
"token_count": 293
} | 1,239 |
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Add and remove a todo', (tester) async {
// Build the widget.
await tester.pumpWidget(const TodoList());
// Enter 'hi' into the TextField.
await tester.enterText(find.byType(TextField)... | website/examples/cookbook/testing/widget/tap_drag/test/main_test.dart/0 | {
"file_path": "website/examples/cookbook/testing/widget/tap_drag/test/main_test.dart",
"repo_id": "website",
"token_count": 1090
} | 1,240 |
import 'package:json_annotation/json_annotation.dart';
import 'address.dart';
part 'user.g.dart';
@JsonSerializable(explicitToJson: true)
class User {
User(this.name, this.address);
String name;
Address address;
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
Map<String, dynamic... | website/examples/development/data-and-backend/json/lib/nested/user.dart/0 | {
"file_path": "website/examples/development/data-and-backend/json/lib/nested/user.dart",
"repo_id": "website",
"token_count": 131
} | 1,241 |
include: package:flutter_lints/flutter.yaml
analyzer:
language:
strict-casts: true
# strict-inference: true
# strict-raw-types: true
linter:
rules:
- always_declare_return_types
- avoid_types_on_closure_parameters
- avoid_void_async
- cancel_subscriptions
- comment_references
-... | website/examples/example_utils/lib/analysis.yaml/0 | {
"file_path": "website/examples/example_utils/lib/analysis.yaml",
"repo_id": "website",
"token_count": 328
} | 1,242 |
import 'package:flutter/material.dart';
// #docregion CustomButton
class CustomButton extends StatelessWidget {
final String label;
const CustomButton(this.label, {super.key});
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () {},
child: Text(label),
);
... | website/examples/get-started/flutter-for/android_devs/lib/custom.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/android_devs/lib/custom.dart",
"repo_id": "website",
"token_count": 205
} | 1,243 |
import 'package:flutter/cupertino.dart';
void main() {
runApp(
const App(),
);
}
class App extends StatelessWidget {
const App({
super.key,
});
@override
Widget build(BuildContext context) {
return const
// #docregion Theme
CupertinoApp(
theme: CupertinoThemeData(
... | website/examples/get-started/flutter-for/ios_devs/lib/cupertino_themes.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/ios_devs/lib/cupertino_themes.dart",
"repo_id": "website",
"token_count": 486
} | 1,244 |
import 'package:flutter/material.dart';
// #docregion StatefulWidget
class SampleApp extends StatelessWidget {
// This widget is the root of your application.
const SampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Sample App',
home: Samp... | website/examples/get-started/flutter-for/ios_devs/lib/text_widget.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/ios_devs/lib/text_widget.dart",
"repo_id": "website",
"token_count": 506
} | 1,245 |
import 'dart:async';
import 'package:flutter/material.dart';
// #docregion StatefulWidget
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({
super.key,
required this.title,
});
final String title;
@override
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
/... | website/examples/get-started/flutter-for/react_native_devs/lib/stateful.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/react_native_devs/lib/stateful.dart",
"repo_id": "website",
"token_count": 698
} | 1,246 |
import 'package:flutter/material.dart';
class MyForm extends StatefulWidget {
const MyForm({super.key});
@override
State<MyForm> createState() => _MyFormState();
}
class _MyFormState extends State<MyForm> {
/// Create a text controller and use it to retrieve the current value
/// of the TextField.
final ... | website/examples/get-started/flutter-for/xamarin_devs/lib/form.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/xamarin_devs/lib/form.dart",
"repo_id": "website",
"token_count": 572
} | 1,247 |
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 MaterialApp(
title: 'Sample App',... | website/examples/get-started/flutter-for/xamarin_devs/lib/validation.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/xamarin_devs/lib/validation.dart",
"repo_id": "website",
"token_count": 747
} | 1,248 |
{
"description": "List of plants by common name",
"source": "https://en.wikipedia.org/wiki/List_of_plants_by_common_name",
"plants": [
{
"name": "Alder",
"species": "Alnus"
},
{
"name": "Black alder",
"species": "Alnus glutinosa, Ilex verticillata"
},
{
"name": "C... | website/examples/integration_test_migration/assets/plants.json/0 | {
"file_path": "website/examples/integration_test_migration/assets/plants.json",
"repo_id": "website",
"token_count": 26487
} | 1,249 |
{
"helloWorld": "¡Hola Mundo!"
}
| website/examples/internationalization/gen_l10n_example/lib/l10n/app_es.arb/0 | {
"file_path": "website/examples/internationalization/gen_l10n_example/lib/l10n/app_es.arb",
"repo_id": "website",
"token_count": 20
} | 1,250 |
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// A simple "rough and ready" example of localizing a Flutter app.
// Spanish and English (locale language codes 'en' and 'es') are
// supported.
// The ... | website/examples/internationalization/minimal/lib/main.dart/0 | {
"file_path": "website/examples/internationalization/minimal/lib/main.dart",
"repo_id": "website",
"token_count": 1096
} | 1,251 |
// Copyright 2019 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 ListDemo extends StatelessWidget {
const ListDemo({super.key, required this.type});
final ListDemoType typ... | website/examples/layout/gallery/lib/list_demo.dart/0 | {
"file_path": "website/examples/layout/gallery/lib/list_demo.dart",
"repo_id": "website",
"token_count": 676
} | 1,252 |
// Basic Flutter widget test.
// Learn more at https://docs.flutter.dev/testing/overview#widget-tests.
import 'package:flutter/foundation.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:layout/main.dart';
void main() {
testWidgets('Example app smoke test', (tester) async {
await tester.p... | website/examples/layout/pavlova/test/widget_test.dart/0 | {
"file_path": "website/examples/layout/pavlova/test/widget_test.dart",
"repo_id": "website",
"token_count": 272
} | 1,253 |
import 'package:flutter/material.dart';
class SomeWidget extends StatelessWidget {
const SomeWidget(this.child, {super.key});
final Widget child;
@override
Widget build(BuildContext context) {
return child;
}
}
| website/examples/state_mgmt/simple/lib/src/common.dart/0 | {
"file_path": "website/examples/state_mgmt/simple/lib/src/common.dart",
"repo_id": "website",
"token_count": 73
} | 1,254 |
import 'package:flutter/material.dart';
void main() {
runApp(
const MaterialApp(
home: AppHome(),
),
);
}
class AppHome extends StatelessWidget {
const AppHome({super.key});
@override
Widget build(BuildContext context) {
return Material(
child: Center(
child: TextButton(
... | website/examples/testing/code_debugging/lib/dump_focus_tree.dart/0 | {
"file_path": "website/examples/testing/code_debugging/lib/dump_focus_tree.dart",
"repo_id": "website",
"token_count": 210
} | 1,255 |
name: debugging
description: A Flutter debugging example.
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:
uses-material-design: tru... | website/examples/testing/debugging/pubspec.yaml/0 | {
"file_path": "website/examples/testing/debugging/pubspec.yaml",
"repo_id": "website",
"token_count": 124
} | 1,256 |
// Copyright 2023 The Flutter Authors. 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:url_launcher/url_launcher.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends Sta... | website/examples/testing/native_debugging/lib/main.dart/0 | {
"file_path": "website/examples/testing/native_debugging/lib/main.dart",
"repo_id": "website",
"token_count": 1175
} | 1,257 |
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../app_model.dart';
class ScrollViewWithScrollbars extends StatefulWidget {
const ScrollViewWithScrollbars({
super.key,
required this.child,
this.axis = Axis.vertical,
});
final Widget child;
final Axis axis;... | website/examples/ui/layout/adaptive_app_demos/lib/widgets/scroll_view_with_scrollbars.dart/0 | {
"file_path": "website/examples/ui/layout/adaptive_app_demos/lib/widgets/scroll_view_with_scrollbars.dart",
"repo_id": "website",
"token_count": 312
} | 1,258 |
import 'package:flutter/rendering.dart';
void showBaselines() {
debugPaintBaselinesEnabled = true;
}
| website/examples/visual_debugging/lib/show_baselines.dart/0 | {
"file_path": "website/examples/visual_debugging/lib/show_baselines.dart",
"repo_id": "website",
"token_count": 35
} | 1,259 |
- name: bash
set-path: echo 'export PATH="$HOME/development/flutter/bin:$PATH"' >> ~/.bash_profile
- name: zsh
set-path: echo 'export PATH="$HOME/development/flutter/bin:$PATH"' >> ~/.zshenv
- name: fish
set-path: fish_add_path -g -p $HOME/development/flutter/bin
- name: csh
set-path: echo 'setenv PATH "$HOME/d... | website/src/_data/shells.yml/0 | {
"file_path": "website/src/_data/shells.yml",
"repo_id": "website",
"token_count": 234
} | 1,260 |
{{site.alert.note}}
Downloading the Flutter SDK
also downloads a compatible version of Dart.
If you've downloaded the Dart SDK separately,
make sure that the Flutter version of `dart` is
first in your path, as the two versions might not be compatible.
The following command tells you whether the `flutter` an... | website/src/_includes/docs/dart-tool.md/0 | {
"file_path": "website/src/_includes/docs/dart-tool.md",
"repo_id": "website",
"token_count": 378
} | 1,261 |
{{site.alert.warning}}
Don't install Flutter to a directory or path that meets
one or both of the following conditions:
* The path contains special characters or spaces.
* The path requires elevated privileges.
As an example, `C:\Program Files` fails both conditions.
{{site.aler... | website/src/_includes/docs/install/admonitions/install-paths.md/0 | {
"file_path": "website/src/_includes/docs/install/admonitions/install-paths.md",
"repo_id": "website",
"token_count": 101
} | 1,262 |
{% assign devos = include.devos %}
{% assign target = include.target %}
1. To develop {{devos}} {{target}} apps, use the following command to install
these packages:
[`clang`][clang],
[`cmake`][cmake],
[`ninja-build`][ninjabuild],
[`pkg-config`][pkg-config],
[`libgtk-3-dev`][gtk3],
[`libstdc++-1... | website/src/_includes/docs/install/reqs/linux/install-desktop-tools.md/0 | {
"file_path": "website/src/_includes/docs/install/reqs/linux/install-desktop-tools.md",
"repo_id": "website",
"token_count": 361
} | 1,263 |
{% if include.target == 'desktop' -%}
4.0 | 52.0 |
{% elsif include.target == 'mobile' -%}
10.0 | 10.0 |
{% elsif include.target == 'web' -%}
2.5 | 2.5 |
{% else -%}
11.0 | 60.0 |
{% endif -%}
{:.table.table-striped}
| website/src/_includes/docs/install/reqs/windows/storage.md/0 | {
"file_path": "website/src/_includes/docs/install/reqs/windows/storage.md",
"repo_id": "website",
"token_count": 107
} | 1,264 |
{% assign route = page.url|regex_replace:'/index$|/index\.html$|\.html$|/$' %}
<header class="site-header">
<nav class="navbar navbar-expand-md justify-content-start justify-content-md-between">
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarSuppor... | website/src/_includes/header.html/0 | {
"file_path": "website/src/_includes/header.html",
"repo_id": "website",
"token_count": 3571
} | 1,265 |
module ActiveNavForPage
def active_nav_for_page(page_url_path = '', active_nav)
# Split the path for this page
# Example: docs.flutter.dev/cookbook/networking/update-data ->
# [cookbook, networking, update-data]
parts = page_url_path.downcase.split('/').drop(1)
current_path_pairs = active_nav
... | website/src/_plugins/active_nav_for_page.rb/0 | {
"file_path": "website/src/_plugins/active_nav_for_page.rb",
"repo_id": "website",
"token_count": 568
} | 1,266 |
module ThrowErrorFilter
def throw_error(message)
raise message
end
end
Liquid::Template.register_filter(ThrowErrorFilter)
| website/src/_plugins/throw_error.rb/0 | {
"file_path": "website/src/_plugins/throw_error.rb",
"repo_id": "website",
"token_count": 39
} | 1,267 |
@use '../base/variables' as *;
@use '../vendor/bootstrap';
.site-sidebar {
font-family: $site-font-family-alt;
padding: $site-sidebar-top-padding 0 ($site-sidebar-top-padding * 2);
// Customization for sidebar in mobile nav
&.site-sidebar--header {
padding: 0;
> .nav > .nav-item {
font-size: bo... | website/src/_sass/components/_sidebar.scss/0 | {
"file_path": "website/src/_sass/components/_sidebar.scss",
"repo_id": "website",
"token_count": 1864
} | 1,268 |
---
title: Add Flutter to an existing app
short-title: Add to app
description: Adding Flutter as a library to an existing Android or iOS app.
---
## Add-to-app
It's sometimes not practical to rewrite your entire application in
Flutter all at once. For those situations,
Flutter can be integrated into your existing
app... | website/src/add-to-app/index.md/0 | {
"file_path": "website/src/add-to-app/index.md",
"repo_id": "website",
"token_count": 1656
} | 1,269 |
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<path fill="#f1a522" d="
M 15,0
L 6,19
L 14,19
L 14,31
L 23,12
L 15,12
Z
"/>
</svg>
| website/src/assets/images/docs/get-started/hot-reload.svg/0 | {
"file_path": "website/src/assets/images/docs/get-started/hot-reload.svg",
"repo_id": "website",
"token_count": 104
} | 1,270 |
Note that the hot-reload.gif file is used in the
README.md file for the flutter/flutter repo.
We no longer use it on any pages in the website repo.
5/2/2020, sz
| website/src/assets/images/docs/tools/android-studio/README/0 | {
"file_path": "website/src/assets/images/docs/tools/android-studio/README",
"repo_id": "website",
"token_count": 53
} | 1,271 |
{% assign id = include.os | downcase -%}
<div id="{{id}}-pub" class="tab-pane
{%- if id == 'windows' %} active {% endif %}"
role="tabpanel" aria-labelledby="{{id}}-tab" markdown="1">
1. Configure a proxy.
To configure a proxy, check out the
[Dart documentation on proxies]({{site.dart-site}}/tools/pub/trou... | website/src/community/china/_pub-settings.md/0 | {
"file_path": "website/src/community/china/_pub-settings.md",
"repo_id": "website",
"token_count": 407
} | 1,272 |
---
title: Drag a UI element
description: How to implement a draggable UI element.
js:
- defer: true
url: https://old-dartpad-3ce3f.web.app/inject_embed.dart.js
---
<?code-excerpt path-base="cookbook/effects/drag_a_widget"?>
Drag and drop is a common mobile app interaction.
As the user long presses (sometimes c... | website/src/cookbook/effects/drag-a-widget.md/0 | {
"file_path": "website/src/cookbook/effects/drag-a-widget.md",
"repo_id": "website",
"token_count": 7882
} | 1,273 |
---
title: Add achievements and leaderboards to your mobile game
description: >
How to use the games_services plugin to add functionality to your game.
---
<?code-excerpt path-base="cookbook/games/achievements_leaderboards"?>
Gamers have various motivations for playing games.
In broad strokes, there are four major ... | website/src/cookbook/games/achievements-leaderboard.md/0 | {
"file_path": "website/src/cookbook/games/achievements-leaderboard.md",
"repo_id": "website",
"token_count": 4262
} | 1,274 |
---
title: Create a horizontal list
description: How to implement a horizontal list.
js:
- defer: true
url: https://old-dartpad-3ce3f.web.app/inject_embed.dart.js
---
<?code-excerpt path-base="cookbook/lists/horizontal_list"?>
You might want to create a list that scrolls
horizontally rather than vertically.
The... | website/src/cookbook/lists/horizontal-list.md/0 | {
"file_path": "website/src/cookbook/lists/horizontal-list.md",
"repo_id": "website",
"token_count": 1340
} | 1,275 |
---
title: Make authenticated requests
description: How to fetch authorized data from a web service.
---
<?code-excerpt path-base="cookbook/networking/authenticated_requests/"?>
To fetch data from most web services, you need to provide
authorization. There are many ways to do this,
but perhaps the most common uses th... | website/src/cookbook/networking/authenticated-requests.md/0 | {
"file_path": "website/src/cookbook/networking/authenticated-requests.md",
"repo_id": "website",
"token_count": 782
} | 1,276 |
---
title: Testing
description: A catalog of recipes showcasing testing your Flutter app.
---
{% include docs/cookbook-toc.md pages=site.pages header_tag='h2' %}
| website/src/cookbook/testing/index.md/0 | {
"file_path": "website/src/cookbook/testing/index.md",
"repo_id": "website",
"token_count": 49
} | 1,277 |
---
title: Networking
description: Internet network calls in Flutter.
---
## Cross-platform http networking
The [`http`][] package provides the simplest way to issue http requests. This
package is supported on Android, iOS, macOS, Windows, Linux and the web.
## Platform notes
Some platforms require additional steps... | website/src/data-and-backend/networking.md/0 | {
"file_path": "website/src/data-and-backend/networking.md",
"repo_id": "website",
"token_count": 347
} | 1,278 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.