Skip to content

About

Minimal Flutter quickstart showing how to use flutter_abp_proxy to generate Retrofit services and Freezed models from an ABP backend.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

flutter_abp_proxy_example

A minimal, runnable Flutter quickstart that shows how to use flutter_abp_proxy to turn an ABP Framework backend into a fully-typed Dart client — no hand-written DTOs, no hand-written Retrofit services.

The app points at the public ABP CMS Kit demo backend (https://cms-kit-demo.abpdemo.com), so you can clone and run it without setting up your own ABP server.

What it does

  • Login screen — calls the generated LoginProxyService with a typed UserLoginInfo request and handles the AbpLoginResult response.
  • Blog list screen — calls the generated BlogPostPublicProxyService and renders a paged list of BlogPostCommonDto items returned as PagedResultDto<BlogPostCommonDto>.

Every DTO, every service, every fromJson/toJson is generated. You never write the networking layer by hand.

Run it

git clone https://github.com/abpjs/flutter_abp_proxy_example.git
cd flutter_abp_proxy_example
flutter pub get
flutter run

The generated proxy files are checked in, so the first run works immediately.

Default credentials for the demo backend: admin / 1q2w3E*. You can also tap "Browse blog posts as guest" to skip login — the blog list endpoint is public.

Regenerate the proxy

If you change the backend, point the generator at your own URL and re-run it:

dart pub global activate flutter_abp_proxy
flutter_abp_proxy \
  --url https://your-abp-backend.com \
  --output lib/data/proxy \
  --clean

dart run build_runner build --delete-conflicting-outputs

That's it. Your new services and models show up under lib/data/proxy/ and you can import them the same way lib/main.dart does.

Project layout

lib/
├── main.dart                     # Login + blog list screens (the only hand-written code)
└── data/
    └── proxy/                    # 100% generated by flutter_abp_proxy
        ├── account/
        │   └── login/
        │       ├── login_service.dart
        │       └── models/
        │           ├── user_login_info.dart
        │           └── abp_login_result.dart
        ├── cms-kit/
        │   └── blog-post-public/
        │       ├── blog-post-public_service.dart
        │       └── models/
        │           ├── blog_post_common_dto.dart
        │           └── cms_user_dto.dart
        └── shared/
            └── models/
                ├── abp_types.dart      # Shared ABP base types (PagedResultDto, EntityDto, ...)
                └── abp_error.dart      # Structured ABP error response envelope

How the generated code is wired up

lib/main.dart instantiates a Dio client and passes it to the generated services. That's the whole integration.

final dio = Dio(BaseOptions(baseUrl: 'https://cms-kit-demo.abpdemo.com'));

// Login
final loginService = LoginProxyService(dio);
final result = await loginService.loginByLogin(
  UserLoginInfo(
    userNameOrEmailAddress: 'admin',
    password: '1q2w3E*',
  ),
);

// List blog posts
final blogService = BlogPostPublicProxyService(dio);
final page = await blogService.getListAsyncByBlogSlugAndInput(
  'cms-kit-demo', // blogSlug
  null, null, null, null, // filters
  0, 20, // skipCount, maxResultCount
);
for (final post in page.items) {
  print(post.title);
}

Learn more

License

MIT

About

Minimal Flutter quickstart showing how to use flutter_abp_proxy to generate Retrofit services and Freezed models from an ABP backend.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages