# Generic functions signature

**URL:** <https://forums.kodeco.com/t/generic-functions-signature/182986>\
**Category:** Dart Apprentice: Beyond the Basics\
**Created:** [January 21, 2023, 9:17am UTC](https://forums.kodeco.com/t/generic-functions-signature/182986 "2023-01-21T09:17:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eshfield](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/eshfield/32/105896_2.png) [@eshfield](https://forums.kodeco.com/u/eshfield)\
**Post date:** [January 21, 2023, 9:17am UTC](https://forums.kodeco.com/t/generic-functions-signature/182986/1 "2023-01-21T09:17:55Z")

</div>

PDF, Chapter 8: Generics, Paragraph **Creating Generic Functions** → **Implementing the Function** :

> `Node<E>? createTree<E>(…) { … }`

Can’t figure out where does the `<E>` in the function name `createTree<E>` come from? I didn’t see that signature in the previous chapters and the previous book — we always use just the `functionName()` syntaxis without angle brackets after the function name.

Can you explain it a little bit?

---

<div class="post-metadata">

**Author:** ![suragch](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/suragch/32/109020_2.png) [@suragch](https://forums.kodeco.com/u/suragch)\
**Post date:** [January 28, 2023, 5:47am UTC](https://forums.kodeco.com/t/generic-functions-signature/182986/2 "2023-01-28T05:47:45Z")

</div>

When you make a generic class, you add the name of the generic type after the class name. For example, in the following class definition:

```dart
class Node<T> {
  // ...
}

```

Writing `<T>` after the class name (that is, `Node<T>`) tells Dart that this class uses generics and the name of the generic type is `T`. If you delete `<T>` you’ll get errors anywhere you refer to `T` from within your class.

That’s how it is with a class. It’s also the same with a function. In the following example:

```dart
Node<E>? createTree<E>(…) {
  // ...
}

```

Writing `<E>` after the function name (that is, `createTree<E>`) tells Dart that this function uses generics and the name of the generic type is `E`. If you delete `<E>` you’ll get errors anywhere you refer to `E` from within your function.

Does that make sense?

Thanks for pointing this missing explanation out. It’s definitely worth explaining and I’ll create a TODO issue in the book repo to add something to the next edition.

---

<div class="post-metadata">

**Author:** ![eshfield](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/eshfield/32/105896_2.png) [@eshfield](https://forums.kodeco.com/u/eshfield)\
**Post date:** [January 28, 2023, 12:25pm UTC](https://forums.kodeco.com/t/generic-functions-signature/182986/3 "2023-01-28T12:25:19Z")

</div>

> [@suragch](#):
>
> Does that make sense?

Definitely. Thank you for detailed explanation!
