NopCommerce mobile app installation

4 gün önce
input: flutter --version
output:
Flutter 3.35.1 • channel stable • https://github.com/flutter/flutter.git
Tools • Dart 3.9.0 • DevTools 2.48.0

mobile-app root directory contain api swagger.json file
mobile-app root directory contain openapitools.json


{
  "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
  "spaces": 2,
  "generator-cli": {
    "version": "6.4.0",
    "generators": {
      "frontend": {
        "input-spec": "swagger.json",
        "generator-name": "dart-dio",
        "output": "frontend_api",
        "additionalProperties": {
          "pubName": "frontend_api"
        }
      }
    }
  }
}


input: openapi-generator-cli version-manager list
output:
2023-02-19  6.4.0        yes        6.4.0 stable

default frontend_api pubspec.yaml file :


name: frontend_api
version: 4.90.02
description: OpenAPI API client
homepage: homepage

environment:
  sdk: '>=3.9.0 <4.0.0'

dependencies:
  dio: 5.9.0
  one_of: 1.5.0
  one_of_serializer: 1.5.0
  built_value: 8.11.1
  built_collection: 5.1.1

dev_dependencies:
  built_value_generator: 8.11.1
  build_runner: 2.6.1
  test: 1.26.3


after that i execute
  openapi-generator-cli generate  


output :
name: frontend_api
version: 1.0.0
description: OpenAPI API client
homepage: homepage

environment:
  sdk: '>=2.15.0 <3.0.0'

dependencies:
  dio: '^5.0.0'
  one_of: '>=1.5.0 <2.0.0'
  one_of_serializer: '>=1.5.0 <2.0.0'
  built_value: '>=8.4.0 <9.0.0'
  built_collection: '>=5.1.1 <6.0.0'

dev_dependencies:
  built_value_generator: '>=8.4.0 <9.0.0'
  build_runner: any
  test: ^1.16.0


where i mistake ?

https://docs.nopcommerce.com/en/developer/mobile-app/index.html
4 gün önce
here readme.md file

# nopcommerce_mobile

This is the official Flutter mobile app by nopCommerce.

## Setup project

Download project

```bash
git clone https://github.com/nopSolutions/nopCommerce-mobile-app.git
```

Get flutter dependencies

```bash
flutter pub get
```

Run the app

```bash
flutter run
```

## Web API client generation

Istall the [OpenAPI Generator](https://openapi-generator.tech/) (Requires [Node.js](https://nodejs.org/en/download/))

To update the version of OpenAPI Generator, use the following command and select the latest stable version from the list provided.

```bash
openapi-generator-cli version-manager list
```

Create a file *openapitools.json*.
Use the [dart-dio](https://openapi-generator.tech/docs/generators/dart-dio) generator.

```json
{
  "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
  "spaces": 2,
  "generator-cli": {
    "version": "6.4.0",
    "generators": {
        "frontend": {
            "input-spec": "swagger.json",
            "generator-name": "dart-dio",
            "output": "frontend_api",
            "additionalProperties": {
                "pubName": "frontend_api"
            }
        }
    }
  }
}
```

It is necessary that the OpenAPI schema *swagger.json* be in the directory with the generator installed.

1. Call the following command to generate the client:

    ```bash
    openapi-generator-cli generate
    ```

1. The standard openapi-generator will only generate base code that uses libraries that rely on Dart's own code generation. Therefore, after the completion of the base generation, it is necessary to start the Dart generator:

    ```bash
    cd frontend_api
    flutter pub get  
    flutter pub run build_runner build -d
    ```

    As a result, we get a ready-made package, which will be located where you specified in  the configuration file or console command. It remains to include it in *pubspec.yaml*:

    ```yaml
    frontend_api: # <- nopCommerce generated api library
        path: lib/frontend_api
    ```

## VS Studio Code

### Editor settings

```json
{
    "[dart]": {
        "editor.codeActionsOnSave": {
            "source.fixAll": true
        },
        "editor.selectionHighlight": false,
        "editor.suggest.snippetsPreventQuickSuggestions": false,
        "editor.suggestSelection": "first",
        "editor.tabCompletion": "onlySnippets",
        "editor.wordBasedSuggestions": false,
    },
    "dart.warnWhenEditingFilesOutsideWorkspace": false,
    "dart.renameFilesWithClasses": "prompt",
    "editor.bracketPairColorization.enabled": true,
    "editor.inlineSuggest.enabled": true,
    "editor.formatOnSave": true,
    "explorer.compactFolders": false,
    "dart.debugExternalPackageLibraries": false,
    "dart.debugSdkLibraries": false,
    "editor.minimap.enabled": false
}
```

### Extensions

Name: **Flutter**\
Id: Dart-Code.flutter\
Description: Flutter support and debugger for Visual Studio Code.\
Publisher: Dart Code\
VS Marketplace Link: <https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter>

Name: **Dart**\
Id: Dart-Code.dart-code\
Description: Dart language support and debugger for Visual Studio Code.\
Publisher: Dart Code\
VS Marketplace Link: <https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code>

Name: **#region folding for VS Code**\
Id: maptz.regionfolder\
Description: Provides folding for text wrapped with #region comments in VS Code.\
Publisher: maptz\
VS Marketplace Link: <https://marketplace.visualstudio.com/items?itemName=maptz.regionfolder>

## Resources

[Client API](./lib/frontend_api/README.md)

[Flutter Docs](https://flutter.dev/docs)

[Riverpod Docs](https://riverpod.dev/docs/getting_started/)
3 gün önce
First, install the latest version of the dart-dio generator as described in the documentation. Currently, it's 7.14.0.

After running the `openapi-generator-cli generate` command, you'll receive a pubspec.yaml file that differs from the one supplied with the mobile app. To use the correct pub package versions, you need to replace the generated pubspec.yaml file with the file from the mobile app's frontend_api folder before running the following commands:
flutter pub get
dart run build_runner build -d
3 gün önce
After this operation, should we delete the lib/frontend_api folder and move the frontend_api folder in the main directory to the lib/frontend_api location?
3 gün önce
openapi-generator-cli version : 7.14.0
openapi-generator-cli generate
copied file from lib/frontend_api/pubspec.yaml to frontend_api/pubspec.yaml
cd frontend_api
frontend_api % flutter pub get  
frontend_api % dart run build_runner build -d


Building package executable... (1.5s)
Built build_runner:build_runner.
Compiling the build script.                                                                                                                                        
                                                                                                                                                                    
log output for build_runner                                                                                                                                        
W ../../../../.pub-cache/hosted/pub.dev/source_gen-3.1.0/lib/src/constants/revive.dart:82:40: Error: The method 'getInvocation' isn't defined for the type          
  'DartObjectImpl'.                                                                                                                                                
   - 'DartObjectImpl' is from 'package:analyzer/src/dart/constant/value.dart'                                                                                      
  ('../../../../.pub-cache/hosted/pub.dev/analyzer-8.4.1/lib/src/dart/constant/value.dart').                                                                        
  Try correcting the name to the name of an existing method, or defining a method named 'getInvocation'.                                                            
    final i = (object as DartObjectImpl).getInvocation();                                                                                                          
                                         ^^^^^^^^^^^^^                                                                                                              
E Failed to compile build script. Check builder definitions and generated script .dart_tool/build/entrypoint/build.dart.      


Failed.
3 gün önce
Yes, you can completely replace the old lib/frontend_api folder with the newly generated one.
3 gün önce
I'm also encountering this error:
Error:
  The method 'getInvocation' isn't defined for the type 'DartObjectImpl'.
   - 'DartObjectImpl' is from 'package:analyzer/src/dart/constant/value.dart'


Workaround:
1. First, run `dart pub downgrade analyzer`

It should look like the example below. Main problem is analyzer in version 8.4. you must downgrade to 8.2.
~\openapi-generator-cli\frontend_api>dart pub downgrade analyzer
Resolving dependencies...
Downloading packages...
< _fe_analyzer_shared 89.0.0 (was 91.0.0)
< analyzer 8.2.0 (was 8.4.1)
Changed 2 dependencies!


2. Then, `dart run build_runner build -d`