Skip to content

Repository files navigation

Base Project

Flutter Base Project


Getting Started

Clone using copy_template

dart pub global activate copy_template
copy_template <project_name> https://github.com/dannndi/flutter_my_app <path>

or

dart pub global activate copy_template
copy_template 

Initialization

1. Run Initialization Script

./script/setup.sh

2. Rename / Change (Manually)

  1. all remaining "com.company.myapp" to "your.bundle.id"
  2. all "my_app" to your "package_name"

3. Setup Environment variable

  1. Copy config.json.example to config.json

Script

Getting started

./script/setup.sh

Simple build runner

./script/build_runner.sh

Create module

./script/gen_module.sh

Generate translation

./script/gen_translate.sh

Feature

1. App Event Broadcaster

AppEventBroadcaster allows you to broadcast events across your app, from any page, widget, or function, and listen to them anywhere.

Example usage:

Push Event
AppEventBroadcaster.I.push(MyEvent());
Listen Event
final sub = AppEventBroadcaster.I.listen((event) {
  print('Received event: $event');
});

// Later, cancel when done
sub.cancel();

2. Safe API Call

handleRequest allows you to call APIs safely, automatically handling network errors and returning a FutureResult<T> (Either<Failure, T>).

Note: The API response JSON must follow this format:

{
  "status": 200,
  "message": "Success",
  "payload": { /* your data here, e.g., object or list */ }
}

Example usage:

// Call API
final result = await handleRequest(
  execute: () async => apiService.getBanners(),
);

// Handle result
result.fold(
  (failure) => print('Error: ${failure.message}'),
  (banners) => print('Got ${banners.length} banners'),
);

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages