How to know what values to give to a property of a class in flutter?

368 views Asked by At
import 'package:flutter/material.dart';

class test extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
   return Card(
     shape: //??? how to know what value to give?
   );
  }
}

I'm new to the Flutter development environment. I started learning Material UI components and came to know about properties, and that each property can be assigned to certain values. How do I know what values to give for a certain property?

In the above code Material component, Card has a property called 'shape. How can I know the possible values for this property?

2

There are 2 answers

0
Nabin Dhakal On

You can Ctrl+click the widget which redirects you to the other dart class where you can find all the attributes regarding the widget you desired. Also you can refer to the API documents and examples for actual use and implementation.

0
CrimsonFoot On

If you see the source code of the class, you could find the 'type' of that property but most of the time they are abstract class so you wouldn't know what concrete type or 'implementation' to use. In my experience, the best way is to refer to the API documentation and check the examples.