Skip to content

Commit af7c4e3

Browse files
committed
feat: add minimal flutter hello world sample (#3512)
1 parent 28b450b commit af7c4e3

File tree

5 files changed

+64
-7
lines changed

5 files changed

+64
-7
lines changed

pkgs/dartpad_ui/lib/primitives/samples.g.dart

Lines changed: 33 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkgs/samples/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ Sample code snippets for DartPad.
88
| Category | Name | Sample | ID |
99
| --- | --- | --- | --- |
1010
| Dart | Fibonacci | [fibonacci.dart](lib/fibonacci.dart) | `fibonacci` |
11-
| Dart | Hello world | [hello_world.dart](lib/hello_world.dart) | `hello-world` |
11+
| Dart | Hello world | [hello_world_dart.dart](lib/hello_world_dart.dart) | `hello-world-dart` |
1212
| Defaults | Dart snippet | [default_dart.dart](lib/default_dart.dart) | `dart` |
1313
| Defaults | Flutter snippet | [default_flutter.dart](lib/default_flutter.dart) | `flutter` |
1414
| Ecosystem | Flame game | [brick_breaker.dart](lib/brick_breaker.dart) | `flame-game` |
1515
| Flutter | Counter | [main.dart](lib/main.dart) | `counter` |
16+
| Flutter | Hello world | [hello_world_flutter.dart](lib/hello_world_flutter.dart) | `hello-world-flutter` |
1617
| Flutter | Sunflower | [sunflower.dart](lib/sunflower.dart) | `sunflower` |
1718
<!-- samples -->
1819

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:flutter/material.dart';
6+
7+
void main() {
8+
runApp(const MyApp());
9+
}
10+
11+
class MyApp extends StatelessWidget {
12+
const MyApp({super.key});
13+
14+
@override
15+
Widget build(BuildContext context) {
16+
return const MaterialApp(
17+
home: Scaffold(body: Center(child: Text('Hello World'))),
18+
);
19+
}
20+
}

pkgs/samples/lib/samples.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
{
1717
"category": "Dart",
1818
"icon": "dart",
19+
"id": "hello-world-dart",
1920
"name": "Hello world",
20-
"path": "lib/hello_world.dart"
21+
"path": "lib/hello_world_dart.dart"
2122
},
2223
{
2324
"category": "Dart",
@@ -37,6 +38,13 @@
3738
"name": "Sunflower",
3839
"path": "lib/sunflower.dart"
3940
},
41+
{
42+
"category": "Flutter",
43+
"icon": "flutter",
44+
"id": "hello-world-flutter",
45+
"name": "Hello world",
46+
"path": "lib/hello_world_flutter.dart"
47+
},
4048
{
4149
"category": "Ecosystem",
4250
"icon": "flame",

0 commit comments

Comments
 (0)