mirror of
https://github.com/flutter/samples.git
synced 2025-11-12 15:58:32 +00:00
Dart 3.9 / Flutter 3.35 [first LLM release] (#2714)
I got carried away with Gemini and basically rewrote CI and the release process for the new LLM reality. This work was largely completed by Gemini. - Bump all SDK versions to the current beta (3.9.0-0) - Run `flutter channel beta` - Wrote `ci_script.dart` to replace the bash scripts - Converted repository to pub workspace #2499 - Added llm.md and release.md - Added redirect for deprecated Samples Index ## Pre-launch Checklist - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I read the [Contributors Guide]. - [x] I have added sample code updates to the [changelog]. - [x] I updated/added relevant documentation (doc comments with `///`).
This commit is contained in:
@@ -31,7 +31,10 @@ class _AddPetDetailsState extends State<AddPetDetails> {
|
||||
icon: const Icon(Icons.add),
|
||||
onPressed: () {
|
||||
PetListMessageChannel.addPetDetails(
|
||||
PetDetails(petType: petType, breed: breedTextController.text),
|
||||
PetDetails(
|
||||
petType: petType,
|
||||
breed: breedTextController.text,
|
||||
),
|
||||
);
|
||||
|
||||
context.pop();
|
||||
@@ -61,8 +64,14 @@ class _AddPetDetailsState extends State<AddPetDetails> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
RadioListTile<String>(title: const Text('Dog'), value: 'Dog'),
|
||||
RadioListTile<String>(title: const Text('Cat'), value: 'Cat'),
|
||||
RadioListTile<String>(
|
||||
title: const Text('Dog'),
|
||||
value: 'Dog',
|
||||
),
|
||||
RadioListTile<String>(
|
||||
title: const Text('Cat'),
|
||||
value: 'Cat',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -11,7 +11,9 @@ class Counter {
|
||||
/// Creates a [MethodChannel] with the specified name to invoke platform method.
|
||||
/// In order to communicate across platforms, the name of MethodChannel
|
||||
/// should be same on native and dart side.
|
||||
static MethodChannel methodChannel = const MethodChannel('methodChannelDemo');
|
||||
static MethodChannel methodChannel = const MethodChannel(
|
||||
'methodChannelDemo',
|
||||
);
|
||||
|
||||
/// This method is responsible to increment and return the value of count.
|
||||
static Future<int> increment({required int counterValue}) async {
|
||||
|
||||
@@ -15,7 +15,8 @@ class PlatformImageFetcher {
|
||||
|
||||
/// Method responsible for providing the platform image.
|
||||
static Future<Uint8List> getImage() async {
|
||||
final reply = await _basicMessageChannel.send('getImage') as Uint8List?;
|
||||
final reply =
|
||||
await _basicMessageChannel.send('getImage') as Uint8List?;
|
||||
if (reply == null) {
|
||||
throw PlatformException(
|
||||
code: 'Error',
|
||||
|
||||
@@ -39,7 +39,9 @@ class _MethodChannelDemoState extends State<MethodChannelDemo> {
|
||||
FilledButton.icon(
|
||||
onPressed: () async {
|
||||
try {
|
||||
final value = await Counter.increment(counterValue: count);
|
||||
final value = await Counter.increment(
|
||||
counterValue: count,
|
||||
);
|
||||
setState(() => count = value);
|
||||
} catch (error) {
|
||||
if (!context.mounted) return;
|
||||
@@ -58,7 +60,9 @@ class _MethodChannelDemoState extends State<MethodChannelDemo> {
|
||||
FilledButton.icon(
|
||||
onPressed: () async {
|
||||
try {
|
||||
final value = await Counter.decrement(counterValue: count);
|
||||
final value = await Counter.decrement(
|
||||
counterValue: count,
|
||||
);
|
||||
setState(() => count = value);
|
||||
} catch (error) {
|
||||
if (!context.mounted) return;
|
||||
|
||||
@@ -34,7 +34,9 @@ class PetListMessageChannel {
|
||||
/// we will throw a [PlatformException].
|
||||
static Future<void> removePet(int index) async {
|
||||
final uInt8List = utf8.encoder.convert(index.toString());
|
||||
final reply = await _binaryCodecChannel.send(uInt8List.buffer.asByteData());
|
||||
final reply = await _binaryCodecChannel.send(
|
||||
uInt8List.buffer.asByteData(),
|
||||
);
|
||||
if (reply == null) {
|
||||
throw PlatformException(
|
||||
code: 'INVALID INDEX',
|
||||
|
||||
@@ -56,10 +56,9 @@ class _PetListScreenState extends State<PetListScreen> {
|
||||
context.go('/petListScreen/addPetDetails');
|
||||
},
|
||||
),
|
||||
body:
|
||||
petListModel.petList.isEmpty
|
||||
? const Center(child: Text('Enter Pet Details'))
|
||||
: BuildPetList(petListModel.petList),
|
||||
body: petListModel.petList.isEmpty
|
||||
? const Center(child: Text('Enter Pet Details'))
|
||||
: BuildPetList(petListModel.petList),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,10 @@ class _PlatformImageDemoState extends State<PlatformImageDemo> {
|
||||
);
|
||||
} else if (snapshot.connectionState ==
|
||||
ConnectionState.done) {
|
||||
return Image.memory(snapshot.data!, fit: BoxFit.fill);
|
||||
return Image.memory(
|
||||
snapshot.data!,
|
||||
fit: BoxFit.fill,
|
||||
);
|
||||
}
|
||||
return const CircularProgressIndicator();
|
||||
},
|
||||
@@ -54,14 +57,13 @@ class _PlatformImageDemoState extends State<PlatformImageDemo> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
FilledButton(
|
||||
onPressed:
|
||||
imageData != null
|
||||
? null
|
||||
: () {
|
||||
setState(() {
|
||||
imageData = PlatformImageFetcher.getImage();
|
||||
});
|
||||
},
|
||||
onPressed: imageData != null
|
||||
? null
|
||||
: () {
|
||||
setState(() {
|
||||
imageData = PlatformImageFetcher.getImage();
|
||||
});
|
||||
},
|
||||
child: const Text('Get Image'),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user