fc function

DeactNode fc(
  1. FunctionalComponent builder, {
  2. Object? key,
})

A helper function to implement functional components.

This functions creates a Functional. The provided builder function will be called in the render function.

States and effects are not bound to a component but to its location the node hierarchy. If no key is provided, the location of a component is compposed of the location of its parent, the type of the component and an index per component type that is increased for every component of the same type beneath the same parent. Thus, if there are 2 functional components without a key beneath the same parent, they will have the index 0 and 1. Even is the position are swapped, the first component will has the index 0 and the second component will has the index 1. To change this behaviour you can provided a key to a component (e.g. a technical id or a name). When a component with a key is moved its states and effects will also move.

Implementation

DeactNode fc(
  FunctionalComponent builder, {
  Object? key,
}) {
  return Functional._(key: key, builder: builder);
}