mirror of
https://github.com/foss42/apidash.git
synced 2025-06-20 14:09:28 +08:00
Update instructions_to_run_generated_code.md
This commit is contained in:
@ -53,39 +53,23 @@ TODO
|
|||||||
|
|
||||||
Here are the detailed instructions for running the generated API Dash code in **Dart (using `http`)** for macOS, Windows, and Linux:
|
Here are the detailed instructions for running the generated API Dash code in **Dart (using `http`)** for macOS, Windows, and Linux:
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### **1. Install Dart**
|
### **1. Install Dart**
|
||||||
To run Dart code, you need to install the Dart SDK.
|
|
||||||
|
|
||||||
- Visit the official **[Dart Installation Guide](https://dart.dev/get-dart)** for step-by-step instructions for macOS, Windows, and Linux.
|
- Visit the official **[Dart Installation Guide](https://dart.dev/get-dart)** for step-by-step installation instructions for macOS, Windows, and Linux.
|
||||||
- Follow the guide to install Dart globally on your system.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### **2. Add the `http` Package**
|
### **2. Add the `http` Package**
|
||||||
To use the `http` package in Dart, you need to add it as a dependency in your project.
|
|
||||||
|
|
||||||
1. Create a new Dart project by running the following command in the terminal:
|
- Add the `http` package as a dependency under the `dependencies` section of the `pubspec.yaml` file:
|
||||||
```bash
|
|
||||||
dart create my_dart_project
|
|
||||||
cd my_dart_project
|
|
||||||
```
|
|
||||||
2. Open the `pubspec.yaml` file in the project directory.
|
|
||||||
3. Add the following line under the `dependencies` section:
|
|
||||||
```yaml
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
http: ^1.2.2
|
http: ^1.2.2
|
||||||
```
|
```
|
||||||
4. Run the following command to fetch the dependency:
|
- Run the following command to fetch the dependency:
|
||||||
```bash
|
```bash
|
||||||
dart pub get
|
dart pub get
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### **3. Run the Generated Code**
|
### **3. Run the Generated Code**
|
||||||
After setting up Dart and the `http` package, follow these steps to execute the generated code:
|
|
||||||
|
|
||||||
#### **Using a Text Editor or IDE (e.g., Visual Studio Code):**
|
#### **Using a Text Editor or IDE (e.g., Visual Studio Code):**
|
||||||
1. Open a text editor or an IDE like Visual Studio Code.
|
1. Open a text editor or an IDE like Visual Studio Code.
|
||||||
@ -102,49 +86,42 @@ After setting up Dart and the `http` package, follow these steps to execute the
|
|||||||
dart run api_test.dart
|
dart run api_test.dart
|
||||||
```
|
```
|
||||||
|
|
||||||
With these steps, you can successfully run API Dash-generated code in Dart using the `http` package! 🚀
|
|
||||||
|
|
||||||
## Dart (dio)
|
## Dart (dio)
|
||||||
|
|
||||||
Here are the detailed instructions for running the generated API Dash code in **Dart (using `dio`)** for macOS, Windows, and Linux:
|
Here are the detailed instructions for running the generated API Dash code in **Dart (using `dio`)** for macOS, Windows, and Linux:
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### **1. Install Dart**
|
### **1. Install Dart**
|
||||||
To run Dart code, you need to install the Dart SDK.
|
|
||||||
|
|
||||||
👉 Follow the instructions provided above under **Dart (http)** for detailed steps on how to install Dart on macOS, Windows, and Linux.
|
- Visit the official **[Dart Installation Guide](https://dart.dev/get-dart)** for step-by-step installation instructions for macOS, Windows, and Linux.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### **2. Add the `dio` Package**
|
### **2. Add the `dio` Package**
|
||||||
To use the `dio` package in Dart, you need to add it as a dependency in your project.
|
|
||||||
|
|
||||||
1. Create a new Dart project by running the following command in the terminal:
|
- Add the `dio` package as a dependency under the `dependencies` section of the `pubspec.yaml` file:
|
||||||
```bash
|
|
||||||
dart create my_dart_project
|
|
||||||
cd my_dart_project
|
|
||||||
```
|
|
||||||
2. Open the `pubspec.yaml` file in the project directory.
|
|
||||||
3. Add the following line under the `dependencies` section:
|
|
||||||
```yaml
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
dio: ^5.7.0
|
dio: ^5.7.0
|
||||||
```
|
```
|
||||||
4. Run the following command to fetch the dependency:
|
- Run the following command to fetch the dependency:
|
||||||
```bash
|
```bash
|
||||||
dart pub get
|
dart pub get
|
||||||
```
|
```
|
||||||
---
|
|
||||||
|
|
||||||
### **3. Run the Generated Code**
|
### **3. Run the Generated Code**
|
||||||
After setting up Dart and the `dio` package, follow these steps to execute the generated code:
|
|
||||||
|
|
||||||
👉 Refer to the instructions under **Dart (http)** for details on how to execute the Dart file using an IDE or the terminal.
|
#### **Using a Text Editor or IDE (e.g., Visual Studio Code):**
|
||||||
|
1. Open a text editor or an IDE like Visual Studio Code.
|
||||||
|
2. Create a new Dart file, such as `api_test.dart`.
|
||||||
|
3. Copy the generated code from API Dash and paste it into this file.
|
||||||
|
4. Save the file.
|
||||||
|
5. Run the Dart file using the terminal or the IDE's built-in tools.
|
||||||
|
|
||||||
---
|
#### **Using the Command Line:**
|
||||||
|
1. Save the generated code to a Dart file, e.g., `api_test.dart`.
|
||||||
With these steps, you can successfully run API Dash-generated code in Dart using the `dio` package! 🚀
|
2. Open a terminal and navigate to the directory containing the file.
|
||||||
|
3. Run the Dart file with the following command:
|
||||||
|
```bash
|
||||||
|
dart run api_test.dart
|
||||||
|
```
|
||||||
|
|
||||||
## Go (net/http)
|
## Go (net/http)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user