Это насколько я понимаю, о чем вы спрашиваете. Пожалуйста, продолжайте
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
class TestPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return TestPageState();
}
}
class TestPageState extends State<TestPage> {
bool selected = false;
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Row(
children: <Widget>[
RaisedButton(
onPressed: () async {
if (selected) {
await Firestore.instance
.collection('Test')
.document('test')
.updateData({'test': ''});
} else {
await Firestore.instance
.collection('Test')
.document('test')
.updateData({'test': '<value-to-be-deleted>'});
}
setState(() {
selected = !selected;
});
},
),
(selected ? Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Text that will disappear'),
): Container())
],
),
),
);
}
}