Skip to main content

Posts

Showing posts from April, 2021

Retrieve Data from Firebase in Flutter

Retrieving Data Using DocumentSnapshot Retrieve Data Stored in a map in firebase First, Add dependencies: dependencies: cloud_firestore: ^1.0.7 Now, run an implicit dart pub get . Note: Install the latest version. Import it Now in your Dart code, you can use: import 'package:cloud_firestore/cloud_firestore.dart' ; Now in your Dart code: DocumentSnapshot documentSnapshot = await FirebaseFirestore. instance .collection( 'Collection_Name' ).doc( 'Document_Id' ).get(); Also, to get data length use: int dataLength = documentSnapshot.data(). length ; To get data of a single map: List<String> dataList = documentSnapshot['key'].toString(); For queries or any other help related to flutter or dart feel free to ask in the comments😊

Flutter Properties 'B'

  1. backgroundColor : It is used to set the specified colour in the background of any material widget. Type: Color Example:      backgroundColor:  Colors.white      backgroundColor: Colors.indigoAccent.shade400 2. borderRadius : The corners of the box are rounded by this BorderRadius.It applies only to boxes with rectangular shapes; ignored if the shape is not BoxShape.rectangle. Type: BorderRadiusGeometry Example:      borderRadius: BorderRadius.circular(8.0) 3. border : A border to draw above the background color, gradient, or image. Type: BoxBorder Example:      border: Border.all(color: Colors.grey,width: 4,style: BorderStyle.solid)

Flutter Properties 'C'

  1.  child :  This can hold any one of the widgets in flutter (such as Text, Column, Row, Container, Center, etc).  To layout multiple widgets , let this widget's child be a widget such as Row, Column, or Stack, which have a children property, and then provide the children to that widget. Type: Widget Syntax:

Flutter Properties 'L'

  1. leading :   A widget to display before the toolbar's title. Maybe an Icon or a CircleAvatar widget. Type: Widget Syntax:      leading:  widget Example:        leading:  Icon(Icons. person )