Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. class _ReviewChangesScreenState extends State<ReviewChangesScreen> {
  2. final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
  3. final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
  4. DocumentSnapshot job;
  5.  
  6. @override
  7. Widget build(BuildContext context) {
  8. return Scaffold(
  9. key: _scaffoldKey,
  10. appBar: AppBar(
  11. title: Text('Review Changes'),
  12. ),
  13. body: Column(children: <Widget>[
  14. Padding(
  15. padding: const EdgeInsets.all(8.0),
  16. child: Form(
  17. key: _formKey,
  18. child: StreamBuilder(
  19. stream: Firestore.instance.collection('jobs').snapshots(),
  20. builder: (BuildContext context,
  21. AsyncSnapshot<QuerySnapshot> snapshot) {
  22. if (!snapshot.hasData) return new Text('Loading...');
  23. return new DropdownButton(
  24. value: job,
  25. onChanged: (val) {
  26. setState(() {
  27. job = val;
  28. });
  29. },
  30. items: snapshot.data.documents
  31. .map<DropdownMenuItem<DocumentSnapshot>>(
  32. (DocumentSnapshot document) {
  33. return new DropdownMenuItem<DocumentSnapshot>(
  34. child: Text(document.data['jobCode']),
  35. value: document,
  36. );
  37. }).toList(),
  38. );
  39. },
  40. )),
  41. ),
  42. ]));
  43. }
  44. }
  45.  
  46. I/flutter ( 7320): The following assertion was thrown building StreamBuilder<QuerySnapshot>(dirty, state:
  47. I/flutter ( 7320): _StreamBuilderBaseState<QuerySnapshot, AsyncSnapshot<QuerySnapshot>>#22b54):
  48. I/flutter ( 7320): 'package:flutter/src/material/dropdown.dart': Failed assertion: line 609 pos 15: 'items == null ||
  49. I/flutter ( 7320): items.isEmpty || value == null || items.where((DropdownMenuItem<T> item) => item.value ==
  50. I/flutter ( 7320): value).length == 1': is not true.
  51.  
  52. Doctor summary (to see all details, run flutter doctor -v):
  53. [√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.17763.529],
  54. locale en-CA)
  55. [√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
  56. [√] Android Studio (version 3.3)
  57. [√] Connected device (1 available)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement