text stringlengths 6 13.6M | id stringlengths 13 176 | metadata dict | __index_level_0__ int64 0 1.69k |
|---|---|---|---|
name: deeplink_store_example
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines ... | samples/deeplink_store_example/pubspec.yaml/0 | {
"file_path": "samples/deeplink_store_example/pubspec.yaml",
"repo_id": "samples",
"token_count": 2628
} | 1,151 |
// 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';
import 'package:flutter/gestures.dart';
import 'package:url_launcher/url_launcher.dart' as url_launcher;
class Pol... | samples/desktop_photo_search/fluent_ui/lib/src/widgets/policy_dialog.dart/0 | {
"file_path": "samples/desktop_photo_search/fluent_ui/lib/src/widgets/policy_dialog.dart",
"repo_id": "samples",
"token_count": 1379
} | 1,152 |
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.flutter.federated_plugin">
</manifest>
| samples/experimental/federated_plugin/federated_plugin/android/src/main/AndroidManifest.xml/0 | {
"file_path": "samples/experimental/federated_plugin/federated_plugin/android/src/main/AndroidManifest.xml",
"repo_id": "samples",
"token_count": 46
} | 1,153 |
#import "GeneratedPluginRegistrant.h"
| samples/experimental/federated_plugin/federated_plugin/example/ios/Runner/Runner-Bridging-Header.h/0 | {
"file_path": "samples/experimental/federated_plugin/federated_plugin/example/ios/Runner/Runner-Bridging-Header.h",
"repo_id": "samples",
"token_count": 13
} | 1,154 |
name: federated_plugin
description: A new flutter plugin project to demonstrate how to implement federated plugin.
version: 0.0.1
publish_to: "none"
environment:
sdk: ^3.2.0
dependencies:
flutter:
sdk: flutter
federated_plugin_platform_interface:
path: ../federated_plugin_platform_interface
federated... | samples/experimental/federated_plugin/federated_plugin/pubspec.yaml/0 | {
"file_path": "samples/experimental/federated_plugin/federated_plugin/pubspec.yaml",
"repo_id": "samples",
"token_count": 385
} | 1,155 |
// 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_platform_interface/battery_method_channel.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter... | samples/experimental/federated_plugin/federated_plugin_platform_interface/test/federated_plugin_platform_interface_test.dart/0 | {
"file_path": "samples/experimental/federated_plugin/federated_plugin_platform_interface/test/federated_plugin_platform_interface_test.dart",
"repo_id": "samples",
"token_count": 346
} | 1,156 |
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'rule.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class RuleAdapter extends TypeAdapter<Rule> {
@override
final int type... | samples/experimental/linting_tool/lib/model/rule.g.dart/0 | {
"file_path": "samples/experimental/linting_tool/lib/model/rule.g.dart",
"repo_id": "samples",
"token_count": 923
} | 1,157 |
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
#include <file_selector_windows/file_selector_windows.h>
#include <url_launcher_windows/url_launcher_windows.h>
#include <window_size/window_size_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
... | samples/experimental/linting_tool/windows/flutter/generated_plugin_registrant.cc/0 | {
"file_path": "samples/experimental/linting_tool/windows/flutter/generated_plugin_registrant.cc",
"repo_id": "samples",
"token_count": 212
} | 1,158 |
-keep class androidx.health.connect.client.** { *; }
-keep class kotlin.coroutines.** { *; }
| samples/experimental/pedometer/example/android/app/proguard-rules.pro/0 | {
"file_path": "samples/experimental/pedometer/example/android/app/proguard-rules.pro",
"repo_id": "samples",
"token_count": 35
} | 1,159 |
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
| samples/experimental/pedometer/example/android/gradle.properties/0 | {
"file_path": "samples/experimental/pedometer/example/android/gradle.properties",
"repo_id": "samples",
"token_count": 31
} | 1,160 |
#import <CoreMotion/CoreMotion.h>
#import <CoreMotion/CMPedometer.h>
#import <Foundation/Foundation.h>
// TODO(https://github.com/dart-lang/native/issues/835): Generate this wrapper
// automatically.
CMPedometerHandler wrapCallback(CMPedometerHandler callback);
| samples/experimental/pedometer/src/pedometerHelper.h/0 | {
"file_path": "samples/experimental/pedometer/src/pedometerHelper.h",
"repo_id": "samples",
"token_count": 86
} | 1,161 |
// 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:ui' as ui;
import 'package:flutter/foundation.dart' show kDebugMode;
import 'package:flutter/material.dart';
class WonkyChar extends StatefulWi... | samples/experimental/varfont_shader_puzzle/lib/components/wonky_char.dart/0 | {
"file_path": "samples/experimental/varfont_shader_puzzle/lib/components/wonky_char.dart",
"repo_id": "samples",
"token_count": 2563
} | 1,162 |
// 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 '../auth/auth.dart';
class SignInPage extends StatelessW... | samples/experimental/web_dashboard/lib/src/pages/sign_in.dart/0 | {
"file_path": "samples/experimental/web_dashboard/lib/src/pages/sign_in.dart",
"repo_id": "samples",
"token_count": 983
} | 1,163 |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A desktop-friendly dashboard app">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-status-bar-sty... | samples/experimental/web_dashboard/web/index.html/0 | {
"file_path": "samples/experimental/web_dashboard/web/index.html",
"repo_id": "samples",
"token_count": 538
} | 1,164 |
include: package:flutter_lints/flutter.yaml
linter:
rules:
# Remove or force lint rules by adding lines like the following.
# The lints below are disabled in order to make things smoother in early
# development. Consider enabling them once development is further along.
prefer_const_constructors: fals... | samples/game_template/analysis_options.yaml/0 | {
"file_path": "samples/game_template/analysis_options.yaml",
"repo_id": "samples",
"token_count": 118
} | 1,165 |
// 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 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:google_mo... | samples/game_template/lib/src/ads/banner_ad_widget.dart/0 | {
"file_path": "samples/game_template/lib/src/ads/banner_ad_widget.dart",
"repo_id": "samples",
"token_count": 2446
} | 1,166 |
// 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 'player_progress_persistence.dart';
/// An in-memory implementation of [PlayerProgressPersistence... | samples/game_template/lib/src/player_progress/persistence/memory_player_progress_persistence.dart/0 | {
"file_path": "samples/game_template/lib/src/player_progress/persistence/memory_player_progress_persistence.dart",
"repo_id": "samples",
"token_count": 218
} | 1,167 |
/*
* Copyright 2019 Google LLC
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... | samples/google_maps/lib/main.dart/0 | {
"file_path": "samples/google_maps/lib/main.dart",
"repo_id": "samples",
"token_count": 752
} | 1,168 |
org.gradle.jvmargs=-Xmx4G
android.useAndroidX=true
android.enableJetifier=true
| samples/infinite_list/android/gradle.properties/0 | {
"file_path": "samples/infinite_list/android/gradle.properties",
"repo_id": "samples",
"token_count": 30
} | 1,169 |
// 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 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'api/fetch.dart';
import 'api/item.dart';
import 'api/page.dart'... | samples/infinite_list/lib/src/catalog.dart/0 | {
"file_path": "samples/infinite_list/lib/src/catalog.dart",
"repo_id": "samples",
"token_count": 1337
} | 1,170 |
#include "../../Flutter/Flutter-Debug.xcconfig"
#include "Warnings.xcconfig"
| samples/infinite_list/macos/Runner/Configs/Debug.xcconfig/0 | {
"file_path": "samples/infinite_list/macos/Runner/Configs/Debug.xcconfig",
"repo_id": "samples",
"token_count": 32
} | 1,171 |
#import "GeneratedPluginRegistrant.h"
| samples/ios_app_clip/ios/Runner/Runner-Bridging-Header.h/0 | {
"file_path": "samples/ios_app_clip/ios/Runner/Runner-Bridging-Header.h",
"repo_id": "samples",
"token_count": 13
} | 1,172 |
name: material_3_demo
description:
A Flutter project showcasing supported Material 3 components, typography, color system and elevation.
Supports different light/dark mode, color seed, and comparison to Material 2.
publish_to: "none"
version: 1.0.0+1
environment:
sdk: ^3.3.0
flutter: ^3.19.0
dependencies:
... | samples/material_3_demo/pubspec.yaml/0 | {
"file_path": "samples/material_3_demo/pubspec.yaml",
"repo_id": "samples",
"token_count": 243
} | 1,173 |
# Navigation and Routing
A sample that shows how to use [go_router][https://pub.dev/packages/go_router]
API to handle common navigation scenarios.
## Goals
- Demonstrate common navigation scenarios:
- Parsing path parameters ('/user/:id')
- Sign in (redirection)
- Nested navigation using ShellRoute
- Demonstrate... | samples/navigation_and_routing/README.md/0 | {
"file_path": "samples/navigation_and_routing/README.md",
"repo_id": "samples",
"token_count": 127
} | 1,174 |
// 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/widgets.dart';
/// A mock authentication service
class BookstoreAuth extends Cha... | samples/navigation_and_routing/lib/src/auth.dart/0 | {
"file_path": "samples/navigation_and_routing/lib/src/auth.dart",
"repo_id": "samples",
"token_count": 410
} | 1,175 |
// 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/services.dart';
/// This class manages a [BasicMessageChannel] that can return an image loaded
/// from a native asset. The [BasicMes... | samples/platform_channels/lib/src/image_basic_message_channel.dart/0 | {
"file_path": "samples/platform_channels/lib/src/image_basic_message_channel.dart",
"repo_id": "samples",
"token_count": 293
} | 1,176 |
include: package:analysis_defaults/flutter.yaml
| samples/platform_design/analysis_options.yaml/0 | {
"file_path": "samples/platform_design/analysis_options.yaml",
"repo_id": "samples",
"token_count": 15
} | 1,177 |
// 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';
/// Page shown when a card in the songs tab is tappe... | samples/platform_design/lib/song_detail_tab.dart/0 | {
"file_path": "samples/platform_design/lib/song_detail_tab.dart",
"repo_id": "samples",
"token_count": 1423
} | 1,178 |
include: package:analysis_defaults/flutter.yaml
| samples/platform_view_swift/analysis_options.yaml/0 | {
"file_path": "samples/platform_view_swift/analysis_options.yaml",
"repo_id": "samples",
"token_count": 15
} | 1,179 |
// Copyright 2019 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 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:provider/provider.dart';
import 'package:provider... | samples/provider_counter/test/widget_test.dart/0 | {
"file_path": "samples/provider_counter/test/widget_test.dart",
"repo_id": "samples",
"token_count": 351
} | 1,180 |
// 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';
import 'package:provider/provider.dart';
import 'package:provider_shopper/models/cart.dart';
class MyCart extends Sta... | samples/provider_shopper/lib/screens/cart.dart/0 | {
"file_path": "samples/provider_shopper/lib/screens/cart.dart",
"repo_id": "samples",
"token_count": 1365
} | 1,181 |
#include "Generated.xcconfig"
| samples/simple_shader/ios/Flutter/Debug.xcconfig/0 | {
"file_path": "samples/simple_shader/ios/Flutter/Debug.xcconfig",
"repo_id": "samples",
"token_count": 12
} | 1,182 |
#include "ephemeral/Flutter-Generated.xcconfig"
| samples/simple_shader/macos/Flutter/Flutter-Debug.xcconfig/0 | {
"file_path": "samples/simple_shader/macos/Flutter/Flutter-Debug.xcconfig",
"repo_id": "samples",
"token_count": 19
} | 1,183 |
package com.example.simplistic_calculator
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
| samples/simplistic_calculator/android/app/src/main/kotlin/com/example/simplistic_calculator/MainActivity.kt/0 | {
"file_path": "samples/simplistic_calculator/android/app/src/main/kotlin/com/example/simplistic_calculator/MainActivity.kt",
"repo_id": "samples",
"token_count": 42
} | 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 'package:test/test.dart';
import 'package:testing_app/models/favorites.dart';
void main() {
group('Testing App Provider Tests', () {
// Create a... | samples/testing_app/test/models/favorites_test.dart/0 | {
"file_path": "samples/testing_app/test/models/favorites_test.dart",
"repo_id": "samples",
"token_count": 361
} | 1,185 |
#!/bin/bash
set -e
flutter doctor -v
###############################################################################
# Helper functions
###############################################################################
# Runs `packages get` on given flutter module.
# $1 = path to flutter module
function flutter_packag... | samples/tool/ios_ci_script.sh/0 | {
"file_path": "samples/tool/ios_ci_script.sh",
"repo_id": "samples",
"token_count": 1021
} | 1,186 |
// 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 'dart:io' show Platform;
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/servic... | samples/veggieseasons/lib/main.dart/0 | {
"file_path": "samples/veggieseasons/lib/main.dart",
"repo_id": "samples",
"token_count": 3925
} | 1,187 |
// 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
// Called by https://pub.dartlang.org/packages/peanut to generate example pages
// for hosting.
//
// Requires at least v3.2.0 of `package:peanut`
import 'dar... | samples/web/_tool/peanut_post_build.dart/0 | {
"file_path": "samples/web/_tool/peanut_post_build.dart",
"repo_id": "samples",
"token_count": 1171
} | 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 'dart:io';
import 'package:checked_yaml/checked_yaml.dart';
import 'src/data.dart';
export 'src/data.dart';
Future<List<Sample>> getSamples() async {... | samples/web/samples_index/lib/samples_index.dart/0 | {
"file_path": "samples/web/samples_index/lib/samples_index.dart",
"repo_id": "samples",
"token_count": 223
} | 1,189 |
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.
version:
revision: f41ae4f4c925336400b11dc02986c1b4d78a173c
channel: master
project_type: app
# Tracks metadata for the flutter migrate comman... | samples/web_embedding/ng-flutter/flutter/.metadata/0 | {
"file_path": "samples/web_embedding/ng-flutter/flutter/.metadata",
"repo_id": "samples",
"token_count": 758
} | 1,190 |
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
| samples/web_embedding/ng-flutter/tsconfig.spec.json/0 | {
"file_path": "samples/web_embedding/ng-flutter/tsconfig.spec.json",
"repo_id": "samples",
"token_count": 125
} | 1,191 |
import 'package:flutter/material.dart';
void main() {
runApp(
const MaterialApp(
home: Page1(),
),
);
}
class Page1 extends StatelessWidget {
const Page1({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Center(
child... | website/examples/cookbook/animation/page_route_animation/lib/main.dart/0 | {
"file_path": "website/examples/cookbook/animation/page_route_animation/lib/main.dart",
"repo_id": "website",
"token_count": 594
} | 1,192 |
name: tabs
description: Sample code for tabs 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/design/tabs/pubspec.yaml/0 | {
"file_path": "website/examples/cookbook/design/tabs/pubspec.yaml",
"repo_id": "website",
"token_count": 89
} | 1,193 |
import 'package:flutter/material.dart';
void main() {
runApp(
const MaterialApp(
home: ExampleDragAndDrop(),
debugShowCheckedModeBanner: false,
),
);
}
const List<Item> _items = [
Item(
name: 'Spinach Pizza',
totalPriceCents: 1299,
uid: '1',
imageProvider: NetworkImage('https... | website/examples/cookbook/effects/drag_a_widget/lib/main.dart/0 | {
"file_path": "website/examples/cookbook/effects/drag_a_widget/lib/main.dart",
"repo_id": "website",
"token_count": 5612
} | 1,194 |
// This file has only enough in it to satisfy `firestore_controller.dart`.
class PlayingCard {
const PlayingCard();
factory PlayingCard.fromJson(Map<String, dynamic> json) {
return const PlayingCard();
}
Map<String, dynamic> toJson() => {
// Nothing
};
}
| website/examples/cookbook/games/firestore_multiplayer/lib/game_internals/playing_card.dart/0 | {
"file_path": "website/examples/cookbook/games/firestore_multiplayer/lib/game_internals/playing_card.dart",
"repo_id": "website",
"token_count": 95
} | 1,195 |
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
const title = 'Floating App Bar';
return MaterialApp(
title: title,
home: Scaffold(
// No app... | website/examples/cookbook/lists/floating_app_bar/lib/main.dart/0 | {
"file_path": "website/examples/cookbook/lists/floating_app_bar/lib/main.dart",
"repo_id": "website",
"token_count": 748
} | 1,196 |
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
// #docregion Routes
// #docregion OnGenerateRoute
return MaterialApp(
routes: {
ExtractArgument... | website/examples/cookbook/navigation/navigate_with_arguments/lib/main.dart/0 | {
"file_path": "website/examples/cookbook/navigation/navigate_with_arguments/lib/main.dart",
"repo_id": "website",
"token_count": 2388
} | 1,197 |
name: returning_data
description: Returning data
environment:
sdk: ^3.3.0
dependencies:
flutter:
sdk: flutter
dev_dependencies:
example_utils:
path: ../../../example_utils
flutter:
uses-material-design: true
| website/examples/cookbook/navigation/returning_data/pubspec.yaml/0 | {
"file_path": "website/examples/cookbook/navigation/returning_data/pubspec.yaml",
"repo_id": "website",
"token_count": 85
} | 1,198 |
name: key_value
publish_to: none
description: >-
Examples and code excerpts for a cookbook recipe that
shows how to use the shared_preferences package.
environment:
sdk: ^3.3.0
dependencies:
flutter:
sdk: flutter
shared_preferences: ^2.2.2
flutter_test:
sdk: flutter
dev_dependencies:
example_ut... | website/examples/cookbook/persistence/key_value/pubspec.yaml/0 | {
"file_path": "website/examples/cookbook/persistence/key_value/pubspec.yaml",
"repo_id": "website",
"token_count": 148
} | 1,199 |
import 'dart:io';
import 'package:flutter/material.dart';
class MyImage extends StatelessWidget {
const MyImage({super.key});
@override
Widget build(BuildContext context) {
// #docregion ImageFile
return Image.file(File('path/to/my/picture.png'));
// #enddocregion ImageFile
}
}
| website/examples/cookbook/plugins/picture_using_camera/lib/image_file.dart/0 | {
"file_path": "website/examples/cookbook/plugins/picture_using_camera/lib/image_file.dart",
"repo_id": "website",
"token_count": 105
} | 1,200 |
// #docregion ScrollWidgetTest
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:scrolling/main.dart';
void main() {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidget... | website/examples/cookbook/testing/integration/profiling/integration_test/scrolling_test.dart/0 | {
"file_path": "website/examples/cookbook/testing/integration/profiling/integration_test/scrolling_test.dart",
"repo_id": "website",
"token_count": 386
} | 1,201 |
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
// #docregion test1
testWidgets('finds a Text widget', (tester) async {
// Build an App with a Text widget that displays the letter 'H'.
await tester.pumpWidget(const MaterialApp(
home: Scaffold(
... | website/examples/cookbook/testing/widget/finders/test/finders_test.dart/0 | {
"file_path": "website/examples/cookbook/testing/widget/finders/test/finders_test.dart",
"repo_id": "website",
"token_count": 444
} | 1,202 |
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'user.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
User _$UserFromJson(Map<String, dynamic> json) => User(
json['n... | website/examples/development/data-and-backend/json/lib/nested/user.g.dart/0 | {
"file_path": "website/examples/development/data-and-backend/json/lib/nested/user.g.dart",
"repo_id": "website",
"token_count": 169
} | 1,203 |
// #docregion CssColors
import 'package:css_colors/css_colors.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 MaterialApp(
home: DemoPage... | website/examples/development/plugin_api_migration/lib/css_colors.dart/0 | {
"file_path": "website/examples/development/plugin_api_migration/lib/css_colors.dart",
"repo_id": "website",
"token_count": 195
} | 1,204 |
name: example_utils
description: Utils for examples and code snippets on docs.flutter.dev.
publish_to: none
environment:
sdk: ^3.3.0
dependencies:
flutter_lints: ^3.0.1
| website/examples/example_utils/pubspec.yaml/0 | {
"file_path": "website/examples/example_utils/pubspec.yaml",
"repo_id": "website",
"token_count": 65
} | 1,205 |
import 'dart:developer' as developer;
import 'package:flutter/material.dart';
class MyButton extends StatelessWidget {
const MyButton({super.key});
// #docregion onPressed
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () {
developer.log('click');
},
... | website/examples/get-started/flutter-for/android_devs/lib/events.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/android_devs/lib/events.dart",
"repo_id": "website",
"token_count": 835
} | 1,206 |
import 'package:flutter/material.dart';
// #docregion Strings
class Strings {
static String welcomeMessage = 'Welcome To Flutter';
}
// #enddocregion Strings
class MyWidget extends StatelessWidget {
const MyWidget({super.key});
@override
Widget build(BuildContext context) {
return
// #docregion A... | website/examples/get-started/flutter-for/android_devs/lib/string_examples.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/android_devs/lib/string_examples.dart",
"repo_id": "website",
"token_count": 137
} | 1,207 |
import 'package:flutter/material.dart';
// #docregion CustomButton
class CustomButton extends StatelessWidget {
const CustomButton(this.label, {super.key});
final String label;
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () {},
child: Text(label),
);
... | website/examples/get-started/flutter-for/ios_devs/lib/custom.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/ios_devs/lib/custom.dart",
"repo_id": "website",
"token_count": 205
} | 1,208 |
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
class MyWidget extends StatelessWidget {
const MyWidget({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
localizationsDelegates: <LocalizationsDelegate<dynam... | website/examples/get-started/flutter-for/ios_devs/lib/localizations_example.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/ios_devs/lib/localizations_example.dart",
"repo_id": "website",
"token_count": 242
} | 1,209 |
// #docregion Theme
import 'package:flutter/material.dart';
class SampleApp extends StatelessWidget {
const SampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Sample App',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Color... | website/examples/get-started/flutter-for/ios_devs/lib/theme.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/ios_devs/lib/theme.dart",
"repo_id": "website",
"token_count": 223
} | 1,210 |
import 'package:flutter/material.dart';
void main() => runApp(
const MyStatelessWidget(
text: 'StatelessWidget Example to show immutable data',
),
);
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({
super.key,
required this.text,
});
final String text;... | website/examples/get-started/flutter-for/react_native_devs/lib/stateless.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/react_native_devs/lib/stateless.dart",
"repo_id": "website",
"token_count": 191
} | 1,211 |
import 'dart:developer' as developer;
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
const MyWidget({super.key});
// #docregion ElevatedButton
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () {
developer.log('click');
... | website/examples/get-started/flutter-for/xamarin_devs/lib/gestures.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/xamarin_devs/lib/gestures.dart",
"repo_id": "website",
"token_count": 809
} | 1,212 |
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class MyWidget extends StatelessWidget {
const MyWidget({super.key});
@override
Widget build(BuildContext context) {
// #docregion Text
return const Text(
'I like Flutter!',
style: TextStyle(fontWeight: FontWeig... | website/examples/get-started/flutter-for/xamarin_devs/lib/views.dart/0 | {
"file_path": "website/examples/get-started/flutter-for/xamarin_devs/lib/views.dart",
"repo_id": "website",
"token_count": 581
} | 1,213 |
// #docregion Imports
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test_migration/main.dart';
// #enddocregion Imports
void main() {
// #docregion Test1
testWidgets('do not select any item, verify please select text is displayed',
(tester) async {
// load the PlantsApp wid... | website/examples/integration_test_migration/integration_test/main_test.dart/0 | {
"file_path": "website/examples/integration_test_migration/integration_test/main_test.dart",
"repo_id": "website",
"token_count": 768
} | 1,214 |
import 'package:flutter/material.dart';
// #docregion AppLocalizationsImport
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
// #enddocregion AppLocalizationsImport
// #docregion LocalizationDelegatesImport
import 'package:flutter_localizations/flutter_localizations.dart';
// #enddocregion LocalizationD... | website/examples/internationalization/gen_l10n_example/lib/main.dart/0 | {
"file_path": "website/examples/internationalization/gen_l10n_example/lib/main.dart",
"repo_id": "website",
"token_count": 1556
} | 1,215 |
name: l10n_example
description: A minimal example of a localized Flutter app
environment:
sdk: ^3.3.0
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
dev_dependencies:
example_utils:
path: ../../example_utils
flutter:
uses-material-design: true
| website/examples/internationalization/minimal/pubspec.yaml/0 | {
"file_path": "website/examples/internationalization/minimal/pubspec.yaml",
"repo_id": "website",
"token_count": 110
} | 1,216 |
import 'package:flutter/material.dart';
void main() => runApp(const HomePage());
const red = Colors.red;
const green = Colors.green;
const blue = Colors.blue;
const big = TextStyle(fontSize: 30);
//////////////////////////////////////////////////
class HomePage extends StatelessWidget {
const HomePage({super.key}... | website/examples/layout/constraints/lib/main.dart/0 | {
"file_path": "website/examples/layout/constraints/lib/main.dart",
"repo_id": "website",
"token_count": 13878
} | 1,217 |
name: gallery
description: >-
Legacy examples referenced in "Layouts in Flutter":
https://docs.flutter.dev/ui/layout.
version: 1.0.0
environment:
sdk: ^3.2.0
dependencies:
animations: ^2.0.11
flutter:
sdk: flutter
dev_dependencies:
example_utils:
path: ../../example_utils
flutter:
uses-materia... | website/examples/layout/gallery/pubspec.yaml/0 | {
"file_path": "website/examples/layout/gallery/pubspec.yaml",
"repo_id": "website",
"token_count": 439
} | 1,218 |
import 'package:flutter/material.dart';
import 'common.dart';
class CallbackPasser extends StatelessWidget {
const CallbackPasser({super.key});
// #docregion methods
@override
Widget build(BuildContext context) {
return SomeWidget(
// Construct the widget, passing it a reference to the method above.... | website/examples/state_mgmt/simple/lib/src/passing_callbacks.dart/0 | {
"file_path": "website/examples/state_mgmt/simple/lib/src/passing_callbacks.dart",
"repo_id": "website",
"token_count": 412
} | 1,219 |
name: native_debugging
description: Demonstration of native code debugging
sdk: ^3.3.0
version: 1.0.0+1
environment:
sdk: ^3.3.0
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.6
url_launcher: ^6.2.4
dev_dependencies:
example_utils:
path: ../../example_utils
flutter_test:
sdk: flut... | website/examples/testing/native_debugging/pubspec.yaml/0 | {
"file_path": "website/examples/testing/native_debugging/pubspec.yaml",
"repo_id": "website",
"token_count": 153
} | 1,220 |
import 'package:flutter/material.dart';
import 'global/device_type.dart';
class AppModel with ChangeNotifier {
bool getDefaultTouchMode() => DeviceType.isMobile;
// Main menu, selected page
int _selectedIndex = 0;
int get selectedIndex => _selectedIndex;
set selectedIndex(int value) => notify(() => _select... | website/examples/ui/layout/adaptive_app_demos/lib/app_model.dart/0 | {
"file_path": "website/examples/ui/layout/adaptive_app_demos/lib/app_model.dart",
"repo_id": "website",
"token_count": 394
} | 1,221 |
name: adaptive_app_demos
description: Demo code for adaptive app development techniques.
publish_to: none
environment:
sdk: ^3.3.0
dependencies:
flutter:
sdk: flutter
bitsdojo_window: ^0.1.6
flextras: ^1.0.0
provider: ^6.1.1
universal_platform: ^1.0.0
platform: ^3.1.4
dev_dependencies:
example_u... | website/examples/ui/layout/adaptive_app_demos/pubspec.yaml/0 | {
"file_path": "website/examples/ui/layout/adaptive_app_demos/pubspec.yaml",
"repo_id": "website",
"token_count": 179
} | 1,222 |
import 'package:flutter/scheduler.dart';
void setSlowAnimations() {
timeDilation = 5.0;
}
| website/examples/visual_debugging/lib/slow_animations.dart/0 | {
"file_path": "website/examples/visual_debugging/lib/slow_animations.dart",
"repo_id": "website",
"token_count": 36
} | 1,223 |
- title: Get started
children:
- title: Install Flutter
permalink: /get-started/install
- title: Test drive
permalink: /get-started/test-drive
- title: Write your first app
permalink: /get-started/codelab
- title: Learn more
permalink: /get-started/learn-more
- divider
... | website/src/_data/sidenav.yml/0 | {
"file_path": "website/src/_data/sidenav.yml",
"repo_id": "website",
"token_count": 9937
} | 1,224 |
{{site.alert.note}}
This codelab uses embedded DartPads to display examples and exercises.
If you see empty boxes instead of DartPads, check out
[Troubleshooting DartPad]({{site.dart-site}}/tools/dartpad/troubleshoot).
{{site.alert.end}}
| website/src/_includes/docs/dartpad-troubleshooting.md/0 | {
"file_path": "website/src/_includes/docs/dartpad-troubleshooting.md",
"repo_id": "website",
"token_count": 80
} | 1,225 |
## Configure Android development
{% assign devos = include.devos %}
{% assign target = include.target %}
{% assign compiler = include.compiler %}
{% assign attempt-time = include.attempt %}
{% case devos %}
{% when 'Windows' -%}
{% assign terminal='PowerShell' %}
{% assign prompt='C:\>' %}
{% when "macOS" -%}
... | website/src/_includes/docs/install/compiler/android.md/0 | {
"file_path": "website/src/_includes/docs/install/compiler/android.md",
"repo_id": "website",
"token_count": 2416
} | 1,226 |
{% 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.
1. Check which shell starts when you open a new console window.
This would b... | website/src/_includes/docs/install/reqs/linux/set-path.md/0 | {
"file_path": "website/src/_includes/docs/install/reqs/linux/set-path.md",
"repo_id": "website",
"token_count": 322
} | 1,227 |
{% comment %}
Include parameters:
- toc_content: The HTML toc content
- class: CSS classes to add to toc element.
- header: header text, default 'Contents'
If you don't want the back-to-top button style `site-toc__back-to-top` as `display: none`.
{% endcomment -%}
{% assign toc = include.toc_content -%}
{... | website/src/_includes/inline-toc.html/0 | {
"file_path": "website/src/_includes/inline-toc.html",
"repo_id": "website",
"token_count": 283
} | 1,228 |
# Generates and stores active entry data for paths
# based on the data declared in `_data/sidenav.yml`.
# This stored active entry data is used in `active_nav_for_page`
# and the `active_nav_for_page` filter it declares to
# determine which entries to indicate as active in the sidenav
# on each page.
module ActiveNavGe... | website/src/_plugins/active_nav_generator.rb/0 | {
"file_path": "website/src/_plugins/active_nav_generator.rb",
"repo_id": "website",
"token_count": 1912
} | 1,229 |
@use 'variables' as *;
@use '../vendor/bootstrap';
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
overflow-x: hidden;
}
.container main {
overflow-x: hidden;
}
h1 {
margin-bottom: bootstrap.bs-spacer(12);
}
h2 {
margin: bootstrap.bs-spacer(12) 0 bootstrap.bs-spacer(8);
... | website/src/_sass/base/_base.scss/0 | {
"file_path": "website/src/_sass/base/_base.scss",
"repo_id": "website",
"token_count": 2822
} | 1,230 |
@use '../base/variables' as *;
@use '../vendor/bootstrap';
.snackbar {
align-items: center;
bottom: $site-snackbar-padding;
display: flex;
justify-content: center;
left: $site-snackbar-padding;
position: fixed;
right: $site-snackbar-padding;
z-index: bootstrap.$zindex-popover;
&__container {
ali... | website/src/_sass/components/_snackbar.scss/0 | {
"file_path": "website/src/_sass/components/_snackbar.scss",
"repo_id": "website",
"token_count": 251
} | 1,231 |
---
title: Add a Flutter screen to an iOS app
short-title: Add a Flutter screen
description: Learn how to add a single Flutter screen to your existing iOS app.
---
This guide describes how to add a single Flutter screen to an existing iOS app.
## Start a FlutterEngine and FlutterViewController
To launch a Flutter sc... | website/src/add-to-app/ios/add-flutter-screen.md/0 | {
"file_path": "website/src/add-to-app/ios/add-flutter-screen.md",
"repo_id": "website",
"token_count": 8480
} | 1,232 |
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="content" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="406px" height="737.85px" viewBox="0 0 406 737.85" e... | website/src/assets/images/branding/flutter/logo+text/vertical/default.svg/0 | {
"file_path": "website/src/assets/images/branding/flutter/logo+text/vertical/default.svg",
"repo_id": "website",
"token_count": 3909
} | 1,233 |
---
title: Using Flutter in China
description: How to use, access, and learn about Flutter in China.
toc: true
os-list: [Windows, macOS, Linux, ChromeOS]
---
{% assign flutter-sdk = 'flutter_opsys_v3.13.0-stable.' %}
{% capture sdk-path -%}flutter_infra_release/releases/stable/opsys/{{flutter-sdk}}{%- endcapture %}
{... | website/src/community/china/index.md/0 | {
"file_path": "website/src/community/china/index.md",
"repo_id": "website",
"token_count": 1901
} | 1,234 |
---
title: Create an expandable FAB
description: How to implement a FAB that expands to multiple buttons when tapped.
js:
- defer: true
url: https://old-dartpad-3ce3f.web.app/inject_embed.dart.js
---
<?code-excerpt path-base="cookbook/effects/expandable_fab"?>
A Floating Action Button (FAB) is a round button th... | website/src/cookbook/effects/expandable-fab.md/0 | {
"file_path": "website/src/cookbook/effects/expandable-fab.md",
"repo_id": "website",
"token_count": 7450
} | 1,235 |
---
title: Add multiplayer support using Firestore
description: >
How to use use Firebase Cloud Firestore to implement multiplayer
in your game.
---
<?code-excerpt path-base="cookbook/games/firestore_multiplayer"?>
Multiplayer games need a way to synchronize game states between players.
Broadly speaking, two type... | website/src/cookbook/games/firestore-multiplayer.md/0 | {
"file_path": "website/src/cookbook/games/firestore-multiplayer.md",
"repo_id": "website",
"token_count": 5408
} | 1,236 |
---
title: Lists
description: A catalog of recipes for handling lists in your Flutter app.
---
{% include docs/cookbook-group-index.md %}
| website/src/cookbook/lists/index.md/0 | {
"file_path": "website/src/cookbook/lists/index.md",
"repo_id": "website",
"token_count": 41
} | 1,237 |
---
title: Parse JSON in the background
description: How to perform a task in the background.
---
<?code-excerpt path-base="cookbook/networking/background_parsing/"?>
By default, Dart apps do all of their work on a single thread.
In many cases, this model simplifies coding and is fast enough
that it does not result i... | website/src/cookbook/networking/background-parsing.md/0 | {
"file_path": "website/src/cookbook/networking/background-parsing.md",
"repo_id": "website",
"token_count": 2860
} | 1,238 |
---
title: Integration
description: >
A catalog of recipes for adding integration testing to your Flutter app.
---
{% include docs/cookbook-group-index.md %}
| website/src/cookbook/testing/integration/index.md/0 | {
"file_path": "website/src/cookbook/testing/integration/index.md",
"repo_id": "website",
"token_count": 45
} | 1,239 |
---
layout: toc
title: Persistence
description: Content covering persistence in Flutter apps.
---
| website/src/data-and-backend/persistence/index.md/0 | {
"file_path": "website/src/data-and-backend/persistence/index.md",
"repo_id": "website",
"token_count": 25
} | 1,240 |
---
title: Obfuscate Dart code
description: How to remove function and class names from your Dart binary.
---
<?code-excerpt path-base="deployment/obfuscate"?>
## What is code obfuscation?
[Code obfuscation][] is the process of modifying an
app's binary to make it harder for humans to understand.
Obfuscation hides f... | website/src/deployment/obfuscate.md/0 | {
"file_path": "website/src/deployment/obfuscate.md",
"repo_id": "website",
"token_count": 1322
} | 1,241 |
---
title: Flutter for Xamarin.Forms developers
description: Learn how to apply Xamarin.Forms developer knowledge when building Flutter apps.
---
<?code-excerpt path-base="get-started/flutter-for/xamarin_devs"?>
This document is meant for Xamarin.Forms developers
looking to apply their existing knowledge
to build mob... | website/src/get-started/flutter-for/xamarin-forms-devs.md/0 | {
"file_path": "website/src/get-started/flutter-for/xamarin-forms-devs.md",
"repo_id": "website",
"token_count": 24617
} | 1,242 |
## Get the Flutter SDK
{% include docs/china-notice.md %}
{% include_relative_help-link.md location='win-get-sdk' %}
1. Download the following installation bundle to get the latest
{{site.sdk.channel}} release of the Flutter SDK:
[(loading...)](#){:.download-latest-link-{{os}}.btn.btn-primary}
For oth... | website/src/get-started/install/_deprecated/_get-sdk-win.md/0 | {
"file_path": "website/src/get-started/install/_deprecated/_get-sdk-win.md",
"repo_id": "website",
"token_count": 919
} | 1,243 |
---
title: Start building Flutter native desktop apps on macOS
description: Configure your system to develop Flutter desktop apps on macOS.
short-title: Make macOS desktop apps
target: desktop
config: macOSDesktop
devos: macOS
next:
title: Create a test app
path: /get-started/test-drive
---
{% include docs/install... | website/src/get-started/install/macos/desktop.md/0 | {
"file_path": "website/src/get-started/install/macos/desktop.md",
"repo_id": "website",
"token_count": 305
} | 1,244 |
---
title: Developing packages & plugins
short-title: Developing
description: How to write packages and plugins for Flutter.
---
## Package introduction
Packages enable the creation of modular code that can be shared easily.
A minimal package consists of the following:
**`pubspec.yaml`**
: A metadata file that decla... | website/src/packages-and-plugins/developing-packages.md/0 | {
"file_path": "website/src/packages-and-plugins/developing-packages.md",
"repo_id": "website",
"token_count": 9230
} | 1,245 |
---
title: Debugging performance for web apps
description: Learn how to use Chrome DevTools to debug web performance issues.
---
{{site.alert.note}}
Profiling Flutter web apps requires Flutter version 3.14 or later.
{{site.alert.end}}
The Flutter framework emits timeline events as it works to build frames,
draw sce... | website/src/perf/web-performance.md/0 | {
"file_path": "website/src/perf/web-performance.md",
"repo_id": "website",
"token_count": 665
} | 1,246 |
---
title: Desktop support for Flutter
description: General information about Flutter support for desktop apps.
---
Flutter provides support for compiling
a native Windows, macOS, or Linux desktop app.
Flutter's desktop support also extends to plugins—you
can install existing plugins that support the Windows,
ma... | website/src/platform-integration/desktop.md/0 | {
"file_path": "website/src/platform-integration/desktop.md",
"repo_id": "website",
"token_count": 2048
} | 1,247 |
---
layout: toc
title: Linux
description: Content covering integration with Linux in Flutter apps.
---
| website/src/platform-integration/linux/index.md/0 | {
"file_path": "website/src/platform-integration/linux/index.md",
"repo_id": "website",
"token_count": 26
} | 1,248 |
---
title: Customizing web app initialization
description: Customize how Flutter apps are initialized on the web
---
You can customize how a Flutter app is initialized on the web
using the `_flutter.loader` JavaScript API provided by `flutter.js`.
This API can be used to display a loading indicator in CSS,
prevent the... | website/src/platform-integration/web/initialization.md/0 | {
"file_path": "website/src/platform-integration/web/initialization.md",
"repo_id": "website",
"token_count": 2872
} | 1,249 |
---
title: Add Windows devtools for Flutter
description: Configure your system to develop Flutter for Windows.
short-title: Add Windows desktop DevTools
target-list: [Android, Web]
---
To choose the guide to add Visual Studio to your Flutter configuration,
click the [Getting Started path][] you followed.
<div class="... | website/src/platform-integration/windows/install-windows/index.md/0 | {
"file_path": "website/src/platform-integration/windows/install-windows/index.md",
"repo_id": "website",
"token_count": 532
} | 1,250 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.