Skip to content

Commit f0e90ad

Browse files
Add instructions to run API Dash-generated code in Dart (dio)
Add instructions to run API Dash-generated code in Dart (dio)
1 parent 7c451e1 commit f0e90ad

File tree

1 file changed

+91
-2
lines changed

1 file changed

+91
-2
lines changed

doc/user_guide/instructions_to_run_generated_code.md

Lines changed: 91 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,100 @@ TODO
5151

5252
## Dart (http)
5353

54-
TODO
54+
Here are the detailed instructions for running the generated API Dash code in **Dart (using `http`)** for macOS, Windows, and Linux:
55+
56+
---
57+
58+
### **1. Install Dart**
59+
To run Dart code, you need to install the Dart SDK.
60+
61+
- Visit the official **[Dart Installation Guide](https://dart.dev/get-dart)** for step-by-step instructions for macOS, Windows, and Linux.
62+
- Follow the guide to install Dart globally on your system.
63+
64+
---
65+
66+
### **2. Add the `http` Package**
67+
To use the `http` package in Dart, you need to add it as a dependency in your project.
68+
69+
1. Create a new Dart project by running the following command in the terminal:
70+
```bash
71+
dart create my_dart_project
72+
cd my_dart_project
73+
```
74+
2. Open the `pubspec.yaml` file in the project directory.
75+
3. Add the following line under the `dependencies` section:
76+
```yaml
77+
dependencies:
78+
http: ^1.2.2
79+
```
80+
4. Run the following command to fetch the dependency:
81+
```bash
82+
dart pub get
83+
```
84+
85+
---
86+
87+
### **3. Run the Generated Code**
88+
After setting up Dart and the `http` package, follow these steps to execute the generated code:
89+
90+
#### **Using a Text Editor or IDE (e.g., Visual Studio Code):**
91+
1. Open a text editor or an IDE like Visual Studio Code.
92+
2. Create a new Dart file, such as `api_test.dart`.
93+
3. Copy the generated code from API Dash and paste it into this file.
94+
4. Save the file.
95+
5. Run the Dart file using the terminal or the IDE's built-in tools.
96+
97+
#### **Using the Command Line:**
98+
1. Save the generated code to a Dart file, e.g., `api_test.dart`.
99+
2. Open a terminal and navigate to the directory containing the file.
100+
3. Run the Dart file with the following command:
101+
```bash
102+
dart run api_test.dart
103+
```
104+
105+
With these steps, you can successfully run API Dash-generated code in Dart using the `http` package! 🚀
55106

56107
## Dart (dio)
57108

58-
TODO
109+
Here are the detailed instructions for running the generated API Dash code in **Dart (using `dio`)** for macOS, Windows, and Linux:
110+
111+
---
112+
113+
### **1. Install Dart**
114+
To run Dart code, you need to install the Dart SDK.
115+
116+
👉 Follow the instructions provided above under **Dart (http)** for detailed steps on how to install Dart on macOS, Windows, and Linux.
117+
118+
---
119+
120+
### **2. Add the `dio` Package**
121+
To use the `dio` package in Dart, you need to add it as a dependency in your project.
122+
123+
1. Create a new Dart project by running the following command in the terminal:
124+
```bash
125+
dart create my_dart_project
126+
cd my_dart_project
127+
```
128+
2. Open the `pubspec.yaml` file in the project directory.
129+
3. Add the following line under the `dependencies` section:
130+
```yaml
131+
dependencies:
132+
dio: ^5.7.0
133+
```
134+
4. Run the following command to fetch the dependency:
135+
```bash
136+
dart pub get
137+
```
138+
---
139+
140+
### **3. Run the Generated Code**
141+
After setting up Dart and the `dio` package, follow these steps to execute the generated code:
142+
143+
👉 Refer to the instructions under **Dart (http)** for details on how to execute the Dart file using an IDE or the terminal.
144+
145+
---
146+
147+
With these steps, you can successfully run API Dash-generated code in Dart using the `dio` package! 🚀
59148

60149
## Go (net/http)
61150

0 commit comments

Comments
 (0)