---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.3
alternate:
  - https://divkit.tech/docs/en/quickstart/flutter.md
  - https://divkit.tech/docs/ru/quickstart/flutter.md
---
> **Documentation Index:** Fetch the complete configuration index at https://divkit.tech/docs/ru/llms.txt

# Flutter
## Подключение DivKitView в свой проект

1. Добавьте зависимость в `pubspec.yaml`:
    ```yaml translate=no
    dependencies:
        divkit: any
    ```
2. Добавьте библиотеку в начало файла, где планируете использовать `DivKitView`:
    ```dart translate=no
    import 'package:divkit/divkit.dart';
    ```
3. Преобразуйте верстку в DivKitData одним из способов:

   - С помощью единого JSON-объекта:
     ```dart translate=no
     final data = DefaultDivKitData.fromJson(json); // Map<String, dynamic>
     ```
   - Используя `card` и `templates` раздельно:
     ```dart translate=no
     final data = DefaultDivKitData.fromScheme(
         card: json['card'], // Map<String, dynamic>
         templates: json['templates'], // Map<String, dynamic>?
     );
     ```

4. Используйте `DivKitView` внутри дерева виджетов, передав в него параметр `data`:
    ```dart translate=no
    DivKitView(
        data: data,
    )
    ```
Для корректной работы `DivKitView` нужно разместить виджет Directionality выше по дереву.

Для кастомизации поведения DivKit можно передать свои собственные реализации обработчиков custom, div-action и другие параметры:
```dart translate=no
DivKitView(
    data: data,
    customHandler: MyCustomHandler(), // DivCustomHandler?
    actionHandler: MyCustomActionHandler(), // DivActionHandler?
    variableStorage: MyOwnVariableStorage(), // DivVariableStorage?
)
```
При использовании собственного `actionHandler` нужно унаследовать `DefaultDivActionHandler` для обработки встроенных div-action.

<!-- source: ru/_includes/index/troubleshooting.md -->
## Узнать больше {#troubleshooting}

Вы можете обсуждать интересующие вас темы в сообществе пользователей DivKit в Telegram: [https://t.me/divkit_community_ru](https://t.me/divkit_community_ru).



[Репозиторий DivKit](https://github.com/divkit/divkit)




<!-- endsource: ru/_includes/index/troubleshooting.md -->
