concept function in category flutter

This is an excerpt from Manning's book Flutter in Action.
In our shopping cart example, the AddToCartButton widget is stateless. It doesn’t need to manage state, and it doesn’t need to know about any other part of the tree. Its job is just to wait to be pressed and then execute a function when that happens.
Functions are the bread and butter of reusable code because they let us define our own vocabulary in our programs. In a robust app, there are likely thousands of lines of code. It’s easy to get lost. When used correctly, higher-order functions help add a layer of abstraction to our code that makes it easy to reason about. Consider these two examples that do math:
List<int> nums = [1,2,3,4,5]; int i = 0; int sum = 0; while (i < nums.length) { sum += nums[i]; i+=1; } print(sum); List<int> nums = [1,2,3,4,5]; print(addNumbers(nums));It’s possible that the addNumbers function (not shown here) is implemented exactly the way the first example adds the numbers. But the second example adds a nice layer of abstraction and tells you exactly what it’s doing, as if you’re reading English. You don’t have to read each line of code to understand what’s happening. And as a bonus, you know that if the addNumbers function is bug-free, it will remain bug-free every time you use it in an app. This is a simple example, of course, but breaking up functions into single-responsibility chunks of logic makes them much easier to get right.
Creating your own vocabulary by breaking up functions is called abstraction. Remember, computers are dumb. We have to tell them exactly what we want them to do. But humans are smart. We use abstraction to write low-level, explicit instructions for the computer, and then we wrap it up in nice little functions for future programmers who will be reading our code.
In Dart, abstracting away logic is possible because it supports these higher-order functions. A function is higher-order if it accepts a function as an argument or if it returns a function. In other words, higher-order functions operate on other functions. If you aren’t sure about higher-order functions, you’ve likely seen them before in a different language:
List<int> nums = [1,2,3]; nums.forEach((number) => print(number + 1));
Recall from earlier that the main function has a return type of void. Any function that’s being used for its side effects should have this return type. It means the function returns nothing.