index

/Text

Button

title

Press

onPress

{()

=>

this

props

onPress

this

props

index

)}

/View

);

// Usage

CustomCard

onPress

this

onPress

index

item

key

In Flutter, define a class to create a custom widget and then reuse the
widget. You can also define and call a function that returns a
reusable widget as shown in the build function in the following example.

In the previous example, the constructor for the CustomCard
class uses Dart’s curly brace syntax { } to indicate named parameters.