Skip to content

Commit 368b5bd

Browse files
committed
Should work now
1 parent 6ba2882 commit 368b5bd

3 files changed

Lines changed: 5 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## 0.8.2
22
- Support for Flutter 3.38
33
- Added `Color` methods, `SafeArea` widget, and `showBottomSheet` function.
4+
- Added `MaterialButton`, `Autocomplete`, and related classes.
45
- Exported multiple wrappers (thanks @Zverik)
56
- Fix typo in example code (thanks @chan150)
67

lib/src/material/autocomplete.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ class $Autocomplete implements $Instance {
357357
final future = (args[1]! as EvalCallable)(runtime, null, [
358358
$TextEditingValue.wrap(textEditingValue),
359359
]);
360-
final value = await (future as Future<dynamic>);
361-
return value;
360+
final value = await future!.$value;
361+
return (value?.$value as Iterable<dynamic>).cast();
362362
},
363363
displayStringForOption: args[2] == null
364364
? RawAutocomplete.defaultStringForOption

test/flutter_eval_test.dart

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ void main() {
448448
'main.dart': '''
449449
import 'package:flutter/material.dart';
450450
class MyWidget extends StatelessWidget {
451-
final _options = [
451+
final List<Option> _options = [
452452
Option(1, 'Alice'),
453453
Option(2, 'Bob'),
454454
Option(3, 'Charlie'),
@@ -458,10 +458,6 @@ void main() {
458458
459459
MyWidget(this.onSelect, {super.key});
460460
461-
Iterable<Option> filterByString(String text) {
462-
return List.of(_options.where((o) => o.title.toLowerCase().contains(text)));
463-
}
464-
465461
@override
466462
Widget build(BuildContext context) {
467463
return MaterialApp(home: Scaffold(
@@ -472,16 +468,7 @@ void main() {
472468
child: Text('Click me'),
473469
optionsBuilder: (value) async {
474470
final text = value.text.toLowerCase();
475-
// return _options; works; nothing of this ↓ does
476-
return _options.where((o) => o.title.toLowerCase().contains(text));
477-
print(1);
478-
return filterByString(text);
479-
print(2);
480-
final opt = _options.where((o) => true);
481-
print(3);
482-
final opt2 = _options.where((o) => o.title.toLowerCase().contains(text));
483-
print(4);
484-
return _options; // .where((o) => o.title.toLowerCase().contains(text));
471+
return _options.where((Option o) => o.title.toLowerCase().contains(text));
485472
},
486473
displayStringForOption: (o) => o.title,
487474
onSelected: (value) {

0 commit comments

Comments
 (0)