pub points coder0211-like Package License


This is a package with functions and widgets to make app development faster and more convenient, currently it is developed by one developer.


1. Base screen

BaseScreen is a base class for all screens in the app.

  • It provides some useful methods for screens.
  • Every screen should extend this class.
  • Example:
class MyHomePage extends BaseScreen {
     const MyHomePage({Key? key}) : super(key: key);
     State<MyHomePage> createState() => _MyHomePageState();

BaseScreenState is a base class for all screen states in the app.

  • It provides the store.
  • AutomaticKeepAliveClientMixin is used to keep the screen alive when the user navigates to another screen.
  • It also provides the initState method to initialize the store instance.
  • It also provides the build method to build the screen.
  • Every screen state should extend this class.
  • BaseScreenState is a stateful widget.
  • Example:
class _MyHomePageState extends BaseScreenState<MyHomePage, MainStore> {
  Widget buildLargeScreen(BuildContext context) {
    // TODO: implement buildLarge
    throw UnimplementedError();

  Widget buildMediumScreen(BuildContext context) {
    // TODO: implement buildMedium
    throw UnimplementedError();

  Widget buildSmallScreen(BuildContext context) {
    // TODO: implement buildSmall
    throw UnimplementedError();

2. Store

State managements

/// Clean before updating:
///    flutter packages pub run build_runner watch --delete-conflicting-outputs

part 'example_store.g.dart';

class ExampleStore = _ExampleStore with _$ExampleStore;

abstract class _ExampleStore with Store, BaseStoreMixin {
  void onInit(BuildContext context) {}

  void onDispose() {}

  Future<void> onWidgetBuildDone(BuildContext context) async {}

  void resetValue() {}

  //... Some values and actions

3. BaseAPI

BaseDataAPI - Base Class for handling API

fetchData is fetch data from API

  • Param url is url of API without domain
  • Param params is params of API with key and value
  • Param body is body of API with key and value
  • Param headers is headers of API with key and value
  • Return BaseDataAPI is object of BaseDataAPI with object and apiStatus
 return BaseDataAPI(object:, apiStatus:ApiStatus.SUCCEEDED);
  • Example:
  Future<void> getData() async {
    BaseAPI _api = BaseAPI();
    BaseAPI.domain = '';
    await _api.fetchData('/data', method: ApiMethod.GET).then((value) {
      switch (value.apiStatus) {
        case ApiStatus.SUCCEEDED:
          // Handle success response here
        case ApiStatus.INTERNET_UNAVAILABLE:
          BaseUtils.showToast('INTERNET UNAVAILABLE', bgColor:;
          // Handle failed response here

4. BaseSharedPreferences

BaseSharedPreferences is a base class for all shared preferences

    String value = '';
    if(await BaseSharedPreferences.containKey('KEY')){
        value = await BaseSharedPreferences.getStringValue('KEY');

5. BaseNavigation

push Push a route to the navigator

  • Param context The context to push the route to
  • Param routeName The routeName to push
  • Param clearStack Clear the stack before pushing the
  • Example:
BaseNavigation.push(context, routeName: '/', clearStack: true);
BaseNavigation.push(context, routeName: '/', clearStack: true, {'id' : 12345});

getArgs Get the arguments from the current route

  • Param context The context to get the arguments
  • Param key The key to get the arguments
  • Example:
BaseNavigation.getArgs(context, key: 'id');

6. TextEX

  • USING : <String>.<Name()>
  • Example:
S.current.splash_screen_title.d1(color: AppColors.whiteText)

7. DoubleEX

  • USING : <Double>.<Name()>
  • Example: