This script adds the CopyWith
extension with locally generated djangoflow_openapi
models to enable the copyWith
extension method. It automates the process of adding the @CopyWith
annotation and necessary imports to the Dart model files.
You can directly execute the script using the following curl | sh
command:
curl -sSL https://raw.githubusercontent.com/djangoflow/flutter-djangoflow/main/packages/djangoflow_openapi_extensions/tool/generate-openapi-copywith.sh | sh
- as
json_serialiable
does not support copyWith method, this script installscopy_with_extension
andcopy_with_extension_gen
in the locally generateddjangoflow_openapi
package and adds@CopyWith
annotation to all the models. - it also generates the generated files
copyWith
methods. - Make sure to have the required tools (Flutter, Dart, and OpenAPI Generator) installed and configured in your environment.
- It may not run
build_runner
due to dart-lang/pub#3978, to resolve it please navigate toYOUR_DIR/packages/djangoflow_openapi
and rundart run build_runner build
manually.