**by @kodeazy**

# flutter How to get smallest element from an array?

- With the help of
`sort()`

function we get the smallest element in array. `sort()`

function sorts the elements in`Asc`

order.- By accessing the first
`index`

we get the smallest element in the array. -
Below is the sample example.

`import 'package:flutter/material.dart'; void main() { print("hello"); var example_array = [9, 8, 7, 6, 5, 4, 3, 2, 1]; example_array.sort(); print(example_array[0]); }`

`Output:`

`1`