getx_base_classes

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

getx base classes

GETX BASE CLASSES #

A collection of base classes for GetX architecture in Flutter, providing common functionality for controllers, views, middleware, and more.
Table of Contents #

Installation
Usage

BaseController
BaseView
BaseWidget
BaseMiddleware
BaseConnect
BaseRequest
BaseResponse
BaseModel
Responsive


Example
Contributing
License

Installation #
To use this package, add getx_base_classes as a dependency in your pubspec.yaml file:
dependencies:
getx_base_classes:
copied to clipboard
Usage #
BaseController #
BaseController provides common functionality for handling asynchronous operations and API calls. Extend this class to create custom controllers for different screens or functionalities.
// Example of using BaseController
class HomeController extends BaseController {
// Your controller implementation
}
copied to clipboard
BaseView #
BaseView is an abstract class representing a base view in a GetX architecture with common functionality. Extend this class to create custom views for different screens or UI components.
// Example of using BaseView
class HomeScreen extends BaseView<HomeController> {
const HomeScreen({super.key});

@override
Widget buildView() => Scaffold(
appBar: AppBar(),
body: Text('Getx Base Classes'),
);
}
copied to clipboard
BaseWidget #
BaseWidget is an abstract class representing a base widget in a GetX architecture with common functionality. Extend this class to create custom widgets for different UI components.
// Example of using BaseWidget
class MyWidget extends BaseWidget<MyController> {
@override
Widget buildView(BuildContext context) {
// Your widget implementation
return Container(
child: Text('Custom Widget'),
);
}
}
copied to clipboard
BaseMiddleware #
BaseMiddleware is a base class for handling navigation and page lifecycle events in GetX.
// Example of using BaseMiddleware
class MyMiddleware extends BaseMiddleware {
// Your middleware implementation
}
copied to clipboard
BaseConnect #
BaseConnect is a class that extends GetConnect for making HTTP requests with common functionality such as setting base URL, headers, and handling authentication.
// Example of using BaseConnect
class MyApiService extends BaseConnect {
// Your API service implementation
}
copied to clipboard
BaseRequest #
BaseRequest is a simple class representing a request with common properties like deviceId and tokenId.
// Example of using BaseRequest
BaseRequest request = BaseRequest(deviceId: '123', tokenId: '456');
copied to clipboard
BaseResponse #
BaseResponse is a generic class representing a response with common properties such as success, message, and data.
// Example of using BaseResponse
BaseResponse<String> response = BaseResponse(success: true, message: 'Success', data: 'Hello');
copied to clipboard
BaseModel #
BaseModel is an abstract class defining the contract for model classes in the application, providing methods for serialization and deserialization.
// Example of using BaseModel
class MyModel extends BaseModel<MyModel> {
@override
MyModel fromJson(Map<String, dynamic> json) {
// Your deserialization logic
return MyModel();
}

@override
Map<String, dynamic> toJson() {
// Your serialization logic
return {};
}
}
copied to clipboard
Responsive #
Responsive is a widget that adjusts its child based on the screen size and orientation, providing utility methods to check the current screen type.
// Example of using Responsive
Widget responsiveWidget = Responsive(
mobile: const Text('Mobile'),
mobileLandscape: const Text('Mobile Landscape'),
tablet: const Text('Tablet'),
tabletLandscape: const Text('Tablet Landscape'),
desktop: const Text('Desktop'),
);
copied to clipboard
Contributing #
Feel free to contribute to this project. If you find any issues or have suggestions, please create an issue or pull request.
License #
This project is licensed under the MIT License - see the LICENSE file for details.

This example includes code snippets and explanations for each of your base classes, making it easier for users to understand how to use them in their projects.


copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.