# Flutter - Dart

## Create a Class `EvntalyClient`&#x20;

```dart
import 'package:http/http.dart' as http;
import 'dart:convert';

class EvntalyClient {
  final String token;
  final String developerSecret;
  final String baseUrl = 'https://app.evntaly.com/prod';

  EvntalyClient(this.token, this.developerSecret);
}
```

## Track Event

```dart
Future<void> sendEvent() async {
  final url = Uri.parse('$baseUrl/api/v1/register/event');
  final payload = {
    "title": "Account License Upgraded",
    "description": "User upgraded their license to Pro",
    "message": "take care.",
    "data": {
      "user_id": "67890",
      "timestamp": "2025-01-08T09:30:00Z",
      "referrer": "social_media",
      "email_verified": false
    },
    "tags": [],
    "notify": true,
    "icon": "⤴️",
    "apply_rule_only": false,
    "user": {"id": "0f6934fd-99c0-41ca-84f4"},
    "type": "Page View",
    "sessionID": "20750ebc-dabf-4fd4-9498-443bf30d6095_bsd",
    "feature": "Backend API",
    "topic": "@api"
  };

  await http.post(url,
    headers: {
      'Content-Type': 'application/json',
      'pat': token, 
      'secret' : developerSecret
    },
    body: jsonEncode(payload),
  );
}
```

## Identify User

```dart
Future<void> identifyUser() async {
  final url = Uri.parse('$baseUrl/api/v1/register/user');
  final payload = {
    "id": "0f6934fd-99c0-41ca-3333",
    "email": "Alameer@evntaly.com",
    "full_name": "Alameer Ashraf",
    "organization": "Evntaly",
    "data": {
      "id": "Alameer-023",
      "email": "Alameer@evntaly.com",
      "Location": "Egypt",
      "timezone": "Africa/Cairo"
    }
  };

  await http.post(url,
    headers: {
      'Content-Type': 'application/json',
      'pat': token,
      'secret': developerSecret
    },
    body: jsonEncode(payload),
  );
}
```

For additional help, contact support at **<support@evntaly.com>**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://evntaly.gitbook.io/evntaly/sdks/curl/flutter-dart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
