Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.

Overview

Languages: English (this file), Indonesian, Urdu, Chinese, Brazilian Portuguese, Spanish, Russian, Polish, Korean, French.

pub package likes building style: effective dart Discord Shield Get on Slack Telegram Awesome Flutter Buy Me A Coffee

About Get

  • GetX is an extra-light and powerful solution for Flutter. It combines high-performance state management, intelligent dependency injection, and route management quickly and practically.

  • GetX has 3 basic principles. This means that these are the priority for all resources in the library: PRODUCTIVITY, PERFORMANCE AND ORGANIZATION.

    • PERFORMANCE: GetX is focused on performance and minimum consumption of resources. GetX does not use Streams or ChangeNotifier.

    • PRODUCTIVITY: GetX uses an easy and pleasant syntax. No matter what you want to do, there is always an easier way with GetX. It will save hours of development and will provide the maximum performance your application can deliver.

      Generally, the developer should be concerned with removing controllers from memory. With GetX this is not necessary because resources are removed from memory when they are not used by default. If you want to keep it in memory, you must explicitly declare "permanent: true" in your dependency. That way, in addition to saving time, you are less at risk of having unnecessary dependencies on memory. Dependency loading is also lazy by default.

    • ORGANIZATION: GetX allows the total decoupling of the View, presentation logic, business logic, dependency injection, and navigation. You do not need context to navigate between routes, so you are not dependent on the widget tree (visualization) for this. You don't need context to access your controllers/blocs through an inheritedWidget, so you completely decouple your presentation logic and business logic from your visualization layer. You do not need to inject your Controllers/Models/Blocs classes into your widget tree through MultiProviders. For this, GetX uses its own dependency injection feature, decoupling the DI from its view completely.

      With GetX you know where to find each feature of your application, having clean code by default. In addition to making maintenance easy, this makes the sharing of modules something that until then in Flutter was unthinkable, something totally possible. BLoC was a starting point for organizing code in Flutter, it separates business logic from visualization. GetX is a natural evolution of this, not only separating the business logic but the presentation logic. Bonus injection of dependencies and routes are also decoupled, and the data layer is out of it all. You know where everything is, and all of this in an easier way than building a hello world. GetX is the easiest, practical, and scalable way to build high-performance applications with the Flutter SDK. It has a large ecosystem around it that works perfectly together, it's easy for beginners, and it's accurate for experts. It is secure, stable, up-to-date, and offers a huge range of APIs built-in that are not present in the default Flutter SDK.

  • GetX is not bloated. It has a multitude of features that allow you to start programming without worrying about anything, but each of these features are in separate containers and are only started after use. If you only use State Management, only State Management will be compiled. If you only use routes, nothing from the state management will be compiled.

  • GetX has a huge ecosystem, a large community, a large number of collaborators, and will be maintained as long as the Flutter exists. GetX too is capable of running with the same code on Android, iOS, Web, Mac, Linux, Windows, and on your server. It is possible to fully reuse your code made on the frontend on your backend with Get Server.

In addition, the entire development process can be completely automated, both on the server and on the front end with Get CLI.

In addition, to further increase your productivity, we have the extension to VSCode and the extension to Android Studio/Intellij

Installing

Add Get to your pubspec.yaml file:

dependencies:
  get:

Import get in files that it will be used:

import 'package:get/get.dart';

Counter App with GetX

The "counter" project created by default on new project on Flutter has over 100 lines (with comments). To show the power of Get, I will demonstrate how to make a "counter" changing the state with each click, switching between pages and sharing the state between screens, all in an organized way, separating the business logic from the view, in ONLY 26 LINES CODE INCLUDING COMMENTS.

  • Step 1: Add "Get" before your MaterialApp, turning it into GetMaterialApp
void main() => runApp(GetMaterialApp(home: Home()));
  • Note: this does not modify the MaterialApp of the Flutter, GetMaterialApp is not a modified MaterialApp, it is just a pre-configured Widget, which has the default MaterialApp as a child. You can configure this manually, but it is definitely not necessary. GetMaterialApp will create routes, inject them, inject translations, inject everything you need for route navigation. If you use Get only for state management or dependency management, it is not necessary to use GetMaterialApp. GetMaterialApp is necessary for routes, snackbars, internationalization, bottomSheets, dialogs, and high-level apis related to routes and absence of context.

  • Note²: This step in only necessary if you gonna use route management (Get.to(), Get.back() and so on). If you not gonna use it then it is not necessary to do step 1

  • Step 2: Create your business logic class and place all variables, methods and controllers inside it. You can make any variable observable using a simple ".obs".

class Controller extends GetxController{
  var count = 0.obs;
  increment() => count++;
}
  • Step 3: Create your View, use StatelessWidget and save some RAM, with Get you may no longer need to use StatefulWidget.
class Home extends StatelessWidget {

  @override
  Widget build(context) {

    // Instantiate your class using Get.put() to make it available for all "child" routes there.
    final Controller c = Get.put(Controller());

    return Scaffold(
      // Use Obx(()=> to update Text() whenever count is changed.
      appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),

      // Replace the 8 lines Navigator.push by a simple Get.to(). You don't need context
      body: Center(child: ElevatedButton(
              child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
      floatingActionButton:
          FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
  }
}

class Other extends StatelessWidget {
  // You can ask Get to find a Controller that is being used by another page and redirect you to it.
  final Controller c = Get.find();

  @override
  Widget build(context){
     // Access the updated count variable
     return Scaffold(body: Center(child: Text("${c.count}")));
  }
}

Result:

This is a simple project but it already makes clear how powerful Get is. As your project grows, this difference will become more significant.

Get was designed to work with teams, but it makes the job of an individual developer simple.

Improve your deadlines, deliver everything on time without losing performance. Get is not for everyone, but if you identified with that phrase, Get is for you!

The Three pillars

State management

Get has two different state managers: the simple state manager (we'll call it GetBuilder) and the reactive state manager (GetX/Obx)

Reactive State Manager

Reactive programming can alienate many people because it is said to be complicated. GetX turns reactive programming into something quite simple:

  • You won't need to create StreamControllers.
  • You won't need to create a StreamBuilder for each variable
  • You will not need to create a class for each state.
  • You will not need to create a get for an initial value.
  • You will not need to use code generators

Reactive programming with Get is as easy as using setState.

Let's imagine that you have a name variable and want that every time you change it, all widgets that use it are automatically changed.

This is your count variable:

var name = 'Jonatas Borges';

To make it observable, you just need to add ".obs" to the end of it:

var name = 'Jonatas Borges'.obs;

And in the UI, when you want to show that value and update the screen whenever the values changes, simply do this:

Obx(() => Text("${controller.name}"));

That's all. It's that simple.

More details about state management

See an more in-depth explanation of state management here. There you will see more examples and also the difference between the simple state manager and the reactive state manager

You will get a good idea of GetX power.

Route management

If you are going to use routes/snackbars/dialogs/bottomsheets without context, GetX is excellent for you too, just see it:

Add "Get" before your MaterialApp, turning it into GetMaterialApp

GetMaterialApp( // Before: MaterialApp(
  home: MyHome(),
)

Navigate to a new screen:

Get.to(NextScreen());

Navigate to new screen with name. See more details on named routes here

Get.toNamed('/details');

To close snackbars, dialogs, bottomsheets, or anything you would normally close with Navigator.pop(context);

Get.back();

To go to the next screen and no option to go back to the previous screen (for use in SplashScreens, login screens, etc.)

Get.off(NextScreen());

To go to the next screen and cancel all previous routes (useful in shopping carts, polls, and tests)

Get.offAll(NextScreen());

Noticed that you didn't have to use context to do any of these things? That's one of the biggest advantages of using Get route management. With this, you can execute all these methods from within your controller class, without worries.

More details about route management

Get works with named routes and also offers lower-level control over your routes! There is in-depth documentation here

Dependency management

Get has a simple and powerful dependency manager that allows you to retrieve the same class as your Bloc or Controller with just 1 lines of code, no Provider context, no inheritedWidget:

Controller controller = Get.put(Controller()); // Rather Controller controller = Controller();
  • Note: If you are using Get's State Manager, pay more attention to the bindings API, which will make it easier to connect your view to your controller.

Instead of instantiating your class within the class you are using, you are instantiating it within the Get instance, which will make it available throughout your App. So you can use your controller (or class Bloc) normally

Tip: Get dependency management is decoupled from other parts of the package, so if for example, your app is already using a state manager (any one, it doesn't matter), you don't need to rewrite it all, you can use this dependency injection with no problems at all

controller.fetchApi();

Imagine that you have navigated through numerous routes, and you need data that was left behind in your controller, you would need a state manager combined with the Provider or Get_it, correct? Not with Get. You just need to ask Get to "find" for your controller, you don't need any additional dependencies:

Controller controller = Get.find();
//Yes, it looks like Magic, Get will find your controller, and will deliver it to you. You can have 1 million controllers instantiated, Get will always give you the right controller.

And then you will be able to recover your controller data that was obtained back there:

Text(controller.textFromApi);

More details about dependency management

See a more in-depth explanation of dependency management here

Utils

Internationalization

Translations

Translations are kept as a simple key-value dictionary map. To add custom translations, create a class and extend Translations.

import 'package:get/get.dart';

class Messages extends Translations {
  @override
  Map<String, Map<String, String>> get keys => {
        'en_US': {
          'hello': 'Hello World',
        },
        'de_DE': {
          'hello': 'Hallo Welt',
        }
      };
}

Using translations

Just append .tr to the specified key and it will be translated, using the current value of Get.locale and Get.fallbackLocale.

Text('title'.tr);

Using translation with singular and plural

var products = [];
Text('singularKey'.trPlural('pluralKey', products.length, Args));

Using translation with parameters

import 'package:get/get.dart';


Map<String, Map<String, String>> get keys => {
    'en_US': {
        'logged_in': 'logged in as @name with email @email',
    },
    'es_ES': {
       'logged_in': 'iniciado sesión como @name con e-mail @email',
    }
};

Text('logged_in'.trParams({
  'name': 'Jhon',
  'email': '[email protected]'
  }));

Locales

Pass parameters to GetMaterialApp to define the locale and translations.

return GetMaterialApp(
    translations: Messages(), // your translations
    locale: Locale('en', 'US'), // translations will be displayed in that locale
    fallbackLocale: Locale('en', 'UK'), // specify the fallback locale in case an invalid locale is selected.
);

Change locale

Call Get.updateLocale(locale) to update the locale. Translations then automatically use the new locale.

var locale = Locale('en', 'US');
Get.updateLocale(locale);

System locale

To read the system locale, you could use Get.deviceLocale.

return GetMaterialApp(
    locale: Get.deviceLocale,
);

Change Theme

Please do not use any higher level widget than GetMaterialApp in order to update it. This can trigger duplicate keys. A lot of people are used to the prehistoric approach of creating a "ThemeProvider" widget just to change the theme of your app, and this is definitely NOT necessary with GetX™.

You can create your custom theme and simply add it within Get.changeTheme without any boilerplate for that:

Get.changeTheme(ThemeData.light());

If you want to create something like a button that changes the Theme in onTap, you can combine two GetX™ APIs for that:

  • The api that checks if the dark Theme is being used.
  • And the Theme Change API, you can just put this within an onPressed:
Get.changeTheme(Get.isDarkMode? ThemeData.light(): ThemeData.dark());

When .darkmode is activated, it will switch to the light theme, and when the light theme becomes active, it will change to dark theme.

GetConnect

GetConnect is an easy way to communicate from your back to your front with http or websockets

Default configuration

You can simply extend GetConnect and use the GET/POST/PUT/DELETE/SOCKET methods to communicate with your Rest API or websockets.

class UserProvider extends GetConnect {
  // Get request
  Future<Response> getUser(int id) => get('http://youapi/users/$id');
  // Post request
  Future<Response> postUser(Map data) => post('http://youapi/users', body: data);
  // Post request with File
  Future<Response<CasesModel>> postCases(List<int> image) {
    final form = FormData({
      'file': MultipartFile(image, filename: 'avatar.png'),
      'otherFile': MultipartFile(image, filename: 'cover.png'),
    });
    return post('http://youapi/users/upload', form);
  }

  GetSocket userMessages() {
    return socket('https://yourapi/users/socket');
  }
}

Custom configuration

GetConnect is highly customizable You can define base Url, as answer modifiers, as Requests modifiers, define an authenticator, and even the number of attempts in which it will try to authenticate itself, in addition to giving the possibility to define a standard decoder that will transform all your requests into your Models without any additional configuration.

class HomeProvider extends GetConnect {
  @override
  void onInit() {
    // All request will pass to jsonEncode so CasesModel.fromJson()
    httpClient.defaultDecoder = CasesModel.fromJson;
    httpClient.baseUrl = 'https://api.covid19api.com';
    // baseUrl = 'https://api.covid19api.com'; // It define baseUrl to
    // Http and websockets if used with no [httpClient] instance

    // It's will attach 'apikey' property on header from all requests
    httpClient.addRequestModifier((request) {
      request.headers['apikey'] = '12345678';
      return request;
    });

    // Even if the server sends data from the country "Brazil",
    // it will never be displayed to users, because you remove
    // that data from the response, even before the response is delivered
    httpClient.addResponseModifier<CasesModel>((request, response) {
      CasesModel model = response.body;
      if (model.countries.contains('Brazil')) {
        model.countries.remove('Brazilll');
      }
    });

    httpClient.addAuthenticator((request) async {
      final response = await get("http://yourapi/token");
      final token = response.body['token'];
      // Set the header
      request.headers['Authorization'] = "$token";
      return request;
    });

    //Autenticator will be called 3 times if HttpStatus is
    //HttpStatus.unauthorized
    httpClient.maxAuthRetries = 3;
  }
  }

  @override
  Future<Response<CasesModel>> getCases(String path) => get(path);
}

GetPage Middleware

The GetPage has now new property that takes a list of GetMiddleWare and run them in the specific order.

Note: When GetPage has a Middlewares, all the children of this page will have the same middlewares automatically.

Priority

The Order of the Middlewares to run can pe set by the priority in the GetMiddleware.

final middlewares = [
  GetMiddleware(priority: 2),
  GetMiddleware(priority: 5),
  GetMiddleware(priority: 4),
  GetMiddleware(priority: -8),
];

those middlewares will be run in this order -8 => 2 => 4 => 5

Redirect

This function will be called when the page of the called route is being searched for. It takes RouteSettings as a result to redirect to. Or give it null and there will be no redirecting.

GetPage redirect( ) {
  final authService = Get.find<AuthService>();
  return authService.authed.value ? null : RouteSettings(name: '/login')
}

onPageCalled

This function will be called when this Page is called before anything created you can use it to change something about the page or give it new page

GetPage onPageCalled(GetPage page) {
  final authService = Get.find<AuthService>();
  return page.copyWith(title: 'Welcome ${authService.UserName}');
}

OnBindingsStart

This function will be called right before the Bindings are initialize. Here you can change Bindings for this page.

List<Bindings> onBindingsStart(List<Bindings> bindings) {
  final authService = Get.find<AuthService>();
  if (authService.isAdmin) {
    bindings.add(AdminBinding());
  }
  return bindings;
}

OnPageBuildStart

This function will be called right after the Bindings are initialize. Here you can do something after that you created the bindings and before creating the page widget.

GetPageBuilder onPageBuildStart(GetPageBuilder page) {
  print('bindings are ready');
  return page;
}

OnPageBuilt

This function will be called right after the GetPage.page function is called and will give you the result of the function. and take the widget that will be showed.

OnPageDispose

This function will be called right after disposing all the related objects (Controllers, views, ...) of the page.

Other Advanced APIs

// give the current args from currentScreen
Get.arguments

// give name of previous route
Get.previousRoute

// give the raw route to access for example, rawRoute.isFirst()
Get.rawRoute

// give access to Routing API from GetObserver
Get.routing

// check if snackbar is open
Get.isSnackbarOpen

// check if dialog is open
Get.isDialogOpen

// check if bottomsheet is open
Get.isBottomSheetOpen

// remove one route.
Get.removeRoute()

// back repeatedly until the predicate returns true.
Get.until()

// go to next route and remove all the previous routes until the predicate returns true.
Get.offUntil()

// go to next named route and remove all the previous routes until the predicate returns true.
Get.offNamedUntil()

//Check in what platform the app is running
GetPlatform.isAndroid
GetPlatform.isIOS
GetPlatform.isMacOS
GetPlatform.isWindows
GetPlatform.isLinux
GetPlatform.isFuchsia

//Check the device type
GetPlatform.isMobile
GetPlatform.isDesktop
//All platforms are supported independently in web!
//You can tell if you are running inside a browser
//on Windows, iOS, OSX, Android, etc.
GetPlatform.isWeb


// Equivalent to : MediaQuery.of(context).size.height,
// but immutable.
Get.height
Get.width

// Gives the current context of the Navigator.
Get.context

// Gives the context of the snackbar/dialog/bottomsheet in the foreground, anywhere in your code.
Get.contextOverlay

// Note: the following methods are extensions on context. Since you
// have access to context in any place of your UI, you can use it anywhere in the UI code

// If you need a changeable height/width (like Desktop or browser windows that can be scaled) you will need to use context.
context.width
context.height

// Gives you the power to define half the screen, a third of it and so on.
// Useful for responsive applications.
// param dividedBy (double) optional - default: 1
// param reducedBy (double) optional - default: 0
context.heightTransformer()
context.widthTransformer()

/// Similar to MediaQuery.of(context).size
context.mediaQuerySize()

/// Similar to MediaQuery.of(context).padding
context.mediaQueryPadding()

/// Similar to MediaQuery.of(context).viewPadding
context.mediaQueryViewPadding()

/// Similar to MediaQuery.of(context).viewInsets;
context.mediaQueryViewInsets()

/// Similar to MediaQuery.of(context).orientation;
context.orientation()

/// Check if device is on landscape mode
context.isLandscape()

/// Check if device is on portrait mode
context.isPortrait()

/// Similar to MediaQuery.of(context).devicePixelRatio;
context.devicePixelRatio()

/// Similar to MediaQuery.of(context).textScaleFactor;
context.textScaleFactor()

/// Get the shortestSide from screen
context.mediaQueryShortestSide()

/// True if width be larger than 800
context.showNavbar()

/// True if the shortestSide is smaller than 600p
context.isPhone()

/// True if the shortestSide is largest than 600p
context.isSmallTablet()

/// True if the shortestSide is largest than 720p
context.isLargeTablet()

/// True if the current device is Tablet
context.isTablet()

/// Returns a value<T> according to the screen size
/// can give value for:
/// watch: if the shortestSide is smaller than 300
/// mobile: if the shortestSide is smaller than 600
/// tablet: if the shortestSide is smaller than 1200
/// desktop: if width is largest than 1200
context.responsiveValue<T>()

Optional Global Settings and Manual configurations

GetMaterialApp configures everything for you, but if you want to configure Get manually.

MaterialApp(
  navigatorKey: Get.key,
  navigatorObservers: [GetObserver()],
);

You will also be able to use your own Middleware within GetObserver, this will not influence anything.

MaterialApp(
  navigatorKey: Get.key,
  navigatorObservers: [
    GetObserver(MiddleWare.observer) // Here
  ],
);

You can create Global Settings for Get. Just add Get.config to your code before pushing any route. Or do it directly in your GetMaterialApp

GetMaterialApp(
  enableLog: true,
  defaultTransition: Transition.fade,
  opaqueRoute: Get.isOpaqueRouteDefault,
  popGesture: Get.isPopGestureEnable,
  transitionDuration: Get.defaultDurationTransition,
  defaultGlobalState: Get.defaultGlobalState,
);

Get.config(
  enableLog = true,
  defaultPopGesture = true,
  defaultTransition = Transitions.cupertino
)

You can optionally redirect all the logging messages from Get. If you want to use your own, favourite logging package, and want to capture the logs there:

GetMaterialApp(
  enableLog: true,
  logWriterCallback: localLogWriter,
);

void localLogWriter(String text, {bool isError = false}) {
  // pass the message to your favourite logging package here
  // please note that even if enableLog: false log messages will be pushed in this callback
  // you get check the flag if you want through GetConfig.isLogEnable
}

Local State Widgets

These Widgets allows you to manage a single value, and keep the state ephemeral and locally. We have flavours for Reactive and Simple. For instance, you might use them to toggle obscureText in a TextField, maybe create a custom Expandable Panel, or maybe modify the current index in BottomNavigationBar while changing the content of the body in a Scaffold.

ValueBuilder

A simplification of StatefulWidget that works with a .setState callback that takes the updated value.

ValueBuilder<bool>(
  initialValue: false,
  builder: (value, updateFn) => Switch(
    value: value,
    onChanged: updateFn, // same signature! you could use ( newValue ) => updateFn( newValue )
  ),
  // if you need to call something outside the builder method.
  onUpdate: (value) => print("Value updated: $value"),
  onDispose: () => print("Widget unmounted"),
),

ObxValue

Similar to ValueBuilder, but this is the Reactive version, you pass a Rx instance (remember the magical .obs?) and updates automatically... isn't it awesome?

ObxValue((data) => Switch(
        value: data.value,
        onChanged: data, // Rx has a _callable_ function! You could use (flag) => data.value = flag,
    ),
    false.obs,
),

Useful tips

.observables (also known as Rx Types) have a wide variety of internal methods and operators.

Is very common to believe that a property with .obs IS the actual value... but make no mistake! We avoid the Type declaration of the variable, because Dart's compiler is smart enough, and the code looks cleaner, but:

var message = 'Hello world'.obs;
print( 'Message "$message" has Type ${message.runtimeType}');

Even if message prints the actual String value, the Type is RxString!

So, you can't do message.substring( 0, 4 ). You have to access the real value inside the observable: The most "used way" is .value, but, did you know that you can also use...

final name = 'GetX'.obs;
// only "updates" the stream, if the value is different from the current one.
name.value = 'Hey';

// All Rx properties are "callable" and returns the new value.
// but this approach does not accepts `null`, the UI will not rebuild.
name('Hello');

// is like a getter, prints 'Hello'.
name() ;

/// numbers:

final count = 0.obs;

// You can use all non mutable operations from num primitives!
count + 1;

// Watch out! this is only valid if `count` is not final, but var
count += 1;

// You can also compare against values:
count > 2;

/// booleans:

final flag = false.obs;

// switches the value between true/false
flag.toggle();


/// all types:

// Sets the `value` to null.
flag.nil();

// All toString(), toJson() operations are passed down to the `value`
print( count ); // calls `toString()` inside  for RxInt

final abc = [0,1,2].obs;
// Converts the value to a json Array, prints RxList
// Json is supported by all Rx types!
print('json: ${jsonEncode(abc)}, type: ${abc.runtimeType}');

// RxMap, RxList and RxSet are special Rx types, that extends their native types.
// but you can work with a List as a regular list, although is reactive!
abc.add(12); // pushes 12 to the list, and UPDATES the stream.
abc[3]; // like Lists, reads the index 3.


// equality works with the Rx and the value, but hashCode is always taken from the value
final number = 12.obs;
print( number == 12 ); // prints > true

/// Custom Rx Models:

// toJson(), toString() are deferred to the child, so you can implement override on them, and print() the observable directly.

class User {
    String name, last;
    int age;
    User({this.name, this.last, this.age});

    @override
    String toString() => '$name $last, $age years old';
}

final user = User(name: 'John', last: 'Doe', age: 33).obs;

// `user` is "reactive", but the properties inside ARE NOT!
// So, if we change some variable inside of it...
user.value.name = 'Roi';
// The widget will not rebuild!,
// `Rx` don't have any clue when you change something inside user.
// So, for custom classes, we need to manually "notify" the change.
user.refresh();

// or we can use the `update()` method!
user.update((value){
  value.name='Roi';
});

print( user );

StateMixin

Another way to handle your UI state is use the StateMixin<T> . To implement it, use the with to add the StateMixin<T> to your controller which allows a T model.

class Controller extends GetController with StateMixin<User>{}

The change() method change the State whenever we want. Just pass the data and the status in this way:

change(data, status: RxStatus.success());

RxStatus allow these status:

RxStatus.loading();
RxStatus.success();
RxStatus.empty();
RxStatus.error('message');

To represent it in the UI, use:

class OtherClass extends GetView<Controller> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(

      body: controller.obx(
        (state)=>Text(state.name),
        
        // here you can put your custom loading indicator, but
        // by default would be Center(child:CircularProgressIndicator())
        onLoading: CustomLoadingIndicator(),
        onEmpty: Text('No data found'),

        // here also you can set your own error widget, but by
        // default will be an Center(child:Text(error))
        onError: (error)=>Text(error),
      ),
    );
}

GetView

I love this Widget, is so simple, yet, so useful!

Is a const Stateless Widget that has a getter controller for a registered Controller, that's all.

 class AwesomeController extends GetController {
   final String title = 'My Awesome View';
 }

  // ALWAYS remember to pass the `Type` you used to register your controller!
 class AwesomeView extends GetView<AwesomeController> {
   @override
   Widget build(BuildContext context) {
     return Container(
       padding: EdgeInsets.all(20),
       child: Text(controller.title), // just call `controller.something`
     );
   }
 }

GetResponsiveView

Extend this widget to build responsive view. this widget contains the screen property that have all information about the screen size and type.

How to use it

You have two options to build it.

  • with builder method you return the widget to build.
  • with methods desktop, tablet,phone, watch. the specific method will be built when the screen type matches the method when the screen is [ScreenType.Tablet] the tablet method will be exuded and so on. Note: If you use this method please set the property alwaysUseBuilder to false

With settings property you can set the width limit for the screen types.

example Code to this screen code

GetWidget

Most people have no idea about this Widget, or totally confuse the usage of it. The use case is very rare, but very specific: It caches a Controller. Because of the cache, can't be a const Stateless.

So, when do you need to "cache" a Controller?

If you use, another "not so common" feature of GetX: Get.create().

Get.create(()=>Controller()) will generate a new Controller each time you call Get.find<Controller>(),

That's where GetWidget shines... as you can use it, for example, to keep a list of Todo items. So, if the widget gets "rebuilt", it will keep the same controller instance.

GetxService

This class is like a GetxController, it shares the same lifecycle ( onInit(), onReady(), onClose()). But has no "logic" inside of it. It just notifies GetX Dependency Injection system, that this subclass can not be removed from memory.

So is super useful to keep your "Services" always reachable and active with Get.find(). Like: ApiService, StorageService, CacheService.

Future<void> main() async {
  await initServices(); /// AWAIT SERVICES INITIALIZATION.
  runApp(SomeApp());
}

/// Is a smart move to make your Services intiialize before you run the Flutter app.
/// as you can control the execution flow (maybe you need to load some Theme configuration,
/// apiKey, language defined by the User... so load SettingService before running ApiService.
/// so GetMaterialApp() doesnt have to rebuild, and takes the values directly.
void initServices() async {
  print('starting services ...');
  /// Here is where you put get_storage, hive, shared_pref initialization.
  /// or moor connection, or whatever that's async.
  await Get.putAsync(() => DbService().init());
  await Get.putAsync(SettingsService()).init();
  print('All services started...');
}

class DbService extends GetxService {
  Future<DbService> init() async {
    print('$runtimeType delays 2 sec');
    await 2.delay();
    print('$runtimeType ready!');
    return this;
  }
}

class SettingsService extends GetxService {
  void init() async {
    print('$runtimeType delays 1 sec');
    await 1.delay();
    print('$runtimeType ready!');
  }
}

The only way to actually delete a GetxService, is with Get.reset() which is like a "Hot Reboot" of your app. So remember, if you need absolute persistence of a class instance during the lifetime of your app, use GetxService.

Breaking changes from 2.0

1- Rx types:

Before After
StringX RxString
IntX RxInt
MapX RxMap
ListX RxList
NumX RxNum
DoubleX RxDouble

RxController and GetBuilder now have merged, you no longer need to memorize which controller you want to use, just use GetxController, it will work for simple state management and for reactive as well.

2- NamedRoutes Before:

GetMaterialApp(
  namedRoutes: {
    '/': GetRoute(page: Home()),
  }
)

Now:

GetMaterialApp(
  getPages: [
    GetPage(name: '/', page: () => Home()),
  ]
)

Why this change? Often, it may be necessary to decide which page will be displayed from a parameter, or a login token, the previous approach was inflexible, as it did not allow this. Inserting the page into a function has significantly reduced the RAM consumption, since the routes will not be allocated in memory since the app was started, and it also allowed to do this type of approach:

GetStorage box = GetStorage();

GetMaterialApp(
  getPages: [
    GetPage(name: '/', page:(){
      return box.hasData('token') ? Home() : Login();
    })
  ]
)

Why Getx?

1- Many times after a Flutter update, many of your packages will break. Sometimes compilation errors happen, errors often appear that there are still no answers about, and the developer needs to know where the error came from, track the error, only then try to open an issue in the corresponding repository, and see its problem solved. Get centralizes the main resources for development (State, dependency and route management), allowing you to add a single package to your pubspec, and start working. After a Flutter update, the only thing you need to do is update the Get dependency, and get to work. Get also resolves compatibility issues. How many times a version of a package is not compatible with the version of another, because one uses a dependency in one version, and the other in another version? This is also not a concern using Get, as everything is in the same package and is fully compatible.

2- Flutter is easy, Flutter is incredible, but Flutter still has some boilerplate that may be unwanted for most developers, such as Navigator.of(context).push (context, builder [...]. Get simplifies development. Instead of writing 8 lines of code to just call a route, you can just do it: Get.to(Home()) and you're done, you'll go to the next page. Dynamic web urls are a really painful thing to do with Flutter currently, and that with GetX is stupidly simple. Managing states in Flutter, and managing dependencies is also something that generates a lot of discussion, as there are hundreds of patterns in the pub. But there is nothing as easy as adding a ".obs" at the end of your variable, and place your widget inside an Obx, and that's it, all updates to that variable will be automatically updated on the screen.

3- Ease without worrying about performance. Flutter's performance is already amazing, but imagine that you use a state manager, and a locator to distribute your blocs/stores/controllers/ etc. classes. You will have to manually call the exclusion of that dependency when you don't need it. But have you ever thought of simply using your controller, and when it was no longer being used by anyone, it would simply be deleted from memory? That's what GetX does. With SmartManagement, everything that is not being used is deleted from memory, and you shouldn't have to worry about anything but programming. You will be assured that you are consuming the minimum necessary resources, without even having created a logic for this.

4- Actual decoupling. You may have heard the concept "separate the view from the business logic". This is not a peculiarity of BLoC, MVC, MVVM, and any other standard on the market has this concept. However, this concept can often be mitigated in Flutter due to the use of context. If you need context to find an InheritedWidget, you need it in the view, or pass the context by parameter. I particularly find this solution very ugly, and to work in teams we will always have a dependence on View's business logic. Getx is unorthodox with the standard approach, and while it does not completely ban the use of StatefulWidgets, InitState, etc., it always has a similar approach that can be cleaner. Controllers have life cycles, and when you need to make an APIREST request for example, you don't depend on anything in the view. You can use onInit to initiate the http call, and when the data arrives, the variables will be populated. As GetX is fully reactive (really, and works under streams), once the items are filled, all widgets that use that variable will be automatically updated in the view. This allows people with UI expertise to work only with widgets, and not have to send anything to business logic other than user events (like clicking a button), while people working with business logic will be free to create and test the business logic separately.

This library will always be updated and implementing new features. Feel free to offer PRs and contribute to them.

Community

Community channels

GetX has a highly active and helpful community. If you have questions, or would like any assistance regarding the use of this framework, please join our community channels, your question will be answered more quickly, and it will be the most suitable place. This repository is exclusive for opening issues, and requesting resources, but feel free to be part of GetX Community.

Slack Discord Telegram
Get on Slack Discord Shield Telegram

How to contribute

Want to contribute to the project? We will be proud to highlight you as one of our collaborators. Here are some points where you can contribute and make Get (and Flutter) even better.

  • Helping to translate the readme into other languages.
  • Adding documentation to the readme (a lot of Get's functions haven't been documented yet).
  • Write articles or make videos teaching how to use Get (they will be inserted in the Readme and in the future in our Wiki).
  • Offering PRs for code/tests.
  • Including new functions.

Any contribution is welcome!

Articles and videos

Issues
  • Controller not remove and onClose not fired in v4.1.4

    Controller not remove and onClose not fired in v4.1.4

    After update to 4.1.4 , I have noticed a some controllers not fired onClose and event this controller not remove from memory !!

    binding.dart

    import 'package:Project/modules/itemAdd/itemAdd.controller.dart';
    import 'package:get/get.dart';
    
    class ItemAddBinding extends Bindings{
      @override
      void dependencies() {
        Get.lazyPut<ItemAddController>(() => ItemAddController());
      }
    }
    
    

    GetPage

     GetPage(
          name: '/item-add',
          page: () => ItemAddView(),
          binding: ItemAddBinding(),
        ),
    
    

    controller.dart

    
    class ItemAddController extends GetxController {
      // controller
      static ItemAddController get to => Get.find();
    
      @override
      void onInit() {
        getActiveOrDefualtBasket();
        super.onInit();
      }
    
    }
    
    

    View.dart

    class ItemAddView extends GetView<ItemAddController> {
      @override
      Widget build(BuildContext context) {
        return Scaffold( .... View Code ......);
    }
    }
    
    

    console log

    
    [GETX] GOING TO ROUTE /item-add
    [GETX] Instance "ItemAddController" has been created
    [GETX] Instance "ItemAddController" has been initialized
    [GETX] CLOSE TO ROUTE /item-add
    < ! ----- missing close controller --- !>
    [GETX] GOING TO ROUTE /item-add
    < ! ----- missing init controller due to not closed --- !>
    [GETX] CLOSE TO ROUTE /item-add
    
    Waiting for customer response 
    opened by niypoo 42
  • About

    About "Complete example of the Flutter counter app in just 11 lines with Get"

    Is your feature request related to a problem? Please describe. I my opinion, this example do not show how good GetX is as a state management. When i saw this code, i wondered: why don't simply make a normal variable and update it normally? I know the counter app is too simple to elaborate, but i think it would be better if you made a controller class and a view class, so it would be more realistic.

    Describe the solution you'd like I would suggest something like this:

    
    void main() => runApp(GetMaterialApp(home: Home()));
    
    class CounterController extends RxController {
      final count = 0.obs;
    }
    
    class Home extends StatelessWidget {
      final CounterController controller = Get.find();
      @override
      Widget build(context) {
        return Scaffold(
        appBar: AppBar(
          title: Text("Get change you life"),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () => controller.count.value++,
        ),
        body: Center(
          child: Obx(() => Text(controller.count.string)),
        ),
      );
    }
    
    

    Note: i don't know if the controller class needs to extends RxController, i saw one place in README that extended, and other place that did not (and this example you put the .obs inside the view, which made me even more confused)

    Anyway, this is just a suggestion on style of your documentation, i am revising it and want to make some small improvements, step by step

    opened by Nipodemos 38
  • Get.arguments is Null

    Get.arguments is Null

    • Reproduce case
    • arrived fcm notification while app is in foreground / background
    • parse payload then route by Get.toNamed(route, arguments: parsed);
    • Get.arguments is null on target page.

    Would you please fix this ?

    More info is needed Waiting for customer response 
    opened by zl910627 33
  • [Docs] Separating documentation in multiple files, and make main README with less information

    [Docs] Separating documentation in multiple files, and make main README with less information

    This is a draft, it should not be merged yet.

    Hello @jonataslaw ! I am thinking about this for a few days, but i don't even know if that is a good idea. Since README is getting gigantic and it will be even bigger when everything gets documented, the main readme file is getting bloated with information. It's a lot for one place.

    My proposal is to split documentation in different files, make the main README have just a resumed version of all GetX can do, and link for the more extended documentation.

    Advantages:

    • The first contact of new users with get can be better, improving the amount of people that want to try it out, and making easier for them to do this
    • It is easier to maintain, because, if you make an update in just one thing, you can change just one file
    • more organization in docs

    Disavantages:

    • Since it will not have all features on one file, the user can't simply use CTRL + F and search the term he/she wants to learn more
    • We will have to focus on two documentations: the resumed version and the extended version

    I think it worth it. If you like the idea, can you give me some advice of what to put in the main README? I'm with little creativity hahah

    opened by Nipodemos 25
  • Change between 3.4.6 and 3.5.0/3.5.1 - All controllers are deleted from memory on app resume

    Change between 3.4.6 and 3.5.0/3.5.1 - All controllers are deleted from memory on app resume

    Describe the bug All controllers are deleted from memory upon app resume

    To Reproduce Steps to reproduce the behavior:

    1. Use version 3.4.6 and all is well
    2. Upgrade to 3.5.0 or 3.5.1 and controllers get removed from memory

    Expected behavior Normal behaviour in my app on 3.4.6 when app was backgrounded and resumed.

    I/flutter (10352): [GETX] AuthController has been initialized
    I/flutter (10352): [GETX] GetMaterialController has been initialized
    I/flutter (10352): [GETX] GOING TO ROUTE /
    I/flutter (10352): [GETX] REPLACE ROUTE /
    I/flutter (10352): [GETX] NEW ROUTE /HomeScreen
    I/flutter (10352): [GETX] HomeScreenController has been initialized
    I/flutter (10352): [GETX] NotificationsController has been initialized
    I/flutter (10352): Running CallController onInit();
    I/flutter (10352): Ran _bindEventListeners();
    I/flutter (10352): [GETX] CallController has been initialized
    

    on 3.5.0 or 3.5.1 this happens when app was backgrounded and resumed.

    I/flutter (32716): Loading isLoggedIn as "true" from device.
    I/flutter (32716): [GETX] AuthController has been initialized
    I/flutter (32716): [GETX] GetMaterialController has been initialized
    I/flutter (32716): [GETX] REPLACE ROUTE /
    I/flutter (32716): [GETX] NEW ROUTE null
    I/flutter (32716): [GETX] REPLACE ROUTE null
    I/flutter (32716): [GETX] NEW ROUTE null
    I/flutter (32716): [GETX] HomeScreenController has been initialized
    I/flutter (32716): [GETX] NotificationsController has been initialized
    I/flutter (32716): Running CallController onInit();
    I/flutter (32716): Ran _bindEventListeners();
    I/flutter (32716): [GETX] CallController has been initialized
    I/flutter (32716): Setting title to: Calls
    I/flutter (32716): Building PageView at position: 0
    I/flutter (32716): [GETX] CallsController instance was created at that time
    I/flutter (32716): [GETX] CallsController has been initialized
    I/flutter (32716): Setting title to: Calls
    I/flutter (32716): Building PageView at position: 0
    I/flutter (32716): [GETX] onClose of HomeScreenController called
    I/flutter (32716): [GETX] HomeScreenController deleted from memory
    I/flutter (32716): [GETX] onClose of NotificationsController called
    I/flutter (32716): [GETX] NotificationsController deleted from memory
    I/flutter (32716): [GETX] onClose of CallController called
    I/flutter (32716): [GETX] CallController deleted from memory
    I/flutter (32716): [GETX] Dio deleted from memory
    I/flutter (32716): [GETX] CallsProvider deleted from memory
    I/flutter (32716): [GETX] CallsRepository deleted from memory
    I/flutter (32716): [GETX] onClose of CallsController called
    I/flutter (32716): [GETX] CallsController deleted from memory
    I/flutter (32716): Caught error: A ScrollPositionWithSingleContext was used after being disposed.
    I/flutter (32716): Once you have called dispose() on a ScrollPositionWithSingleContext, it can no longer be used.
    I/flutter (32716): stackTrace: #0      ChangeNotifier._debugAssertNotDisposed.<anonymous closure> (package:flutter/src/foundation/change_notifier
    

    Flutter Version:

    [✓] Flutter (Channel stable, 1.20.2, on Linux, locale en_GB.UTF-8)
        • Flutter version 1.20.2 at /home/ghenry/development/flutter
        • Framework revision bbfbf1770c (2 weeks ago), 2020-08-13 08:33:09 -0700
        • Engine revision 9d5b21729f
        • Dart version 2.9.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
        • Android SDK at /home/ghenry/Android/Sdk
        • Platform android-30, build-tools 28.0.3
        • Java binary at: /home/ghenry/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/192.6392135/jre/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
        • All Android licenses accepted.
    
    [✓] Android Studio (version 3.6)
        • Android Studio at /home/ghenry/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/192.6392135
        • Flutter plugin version 37.1.1
        • Dart plugin version 183.6270
        • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    
    [✓] VS Code (version 1.47.3)
        • VS Code at /usr/share/code
        • Flutter extension version 3.2.0
    
    [✓] Connected device (1 available)
        • sdk gphone x86 (mobile) • emulator-5556 • android-x86 • Android 11 (API 30) (emulator)
    
    

    Get Version: 3.4.6 working, 3.5.0 and 3.5.1 not.

    Describe on which device you found the bug: Android simulater Pixel 3a API 30, Samsung S10e Android 10, iPhone 8, iPhone SE 2nd11 Pro simulator

    Minimal reproduce code My Entry point is:

                initialBinding: InitialBinding(),
                home: SplashScreen()));
    

    ....

    class InitialBinding implements Bindings {
      @override
      void dependencies() {
        Get.put(UserRepository());
        Get.put(AuthController());
      }
    }
    

    which is actually still just like this:

    https://github.com/jonataslaw/getx/issues/223#issuecomment-642350349

    Thanks.

    Waiting for customer response 
    opened by ghenry 24
  • I need your opinion.

    I need your opinion.

    I'm working on version 3.0 of Get, and I need your opinion on some topics.

    1. I have received countless issues and messages asking to change the lib name, as "Get" is the most common word in English, which makes the search IMPOSSIBLE. I even run into questions on StackOverflow by chance, because it is impossible to find something through research. I thought of "GetX" to not have to create another repository, another package in the pub and etc. I could take advantage of Get, and just name the Package name as GetX. If someone has a better suggestion, speak up, or say if you agree with that.

    2. Get will now become a framework (no longer micro), will have its own CLI, its extensions for VsCode / Intellij, and soon a unique solution that will be launched as soon as it is patented (it will be open source, but the idea needs to be protected). We will add internationalization (translation package), Storage (storage of key / value as sharedPreferences, but synchronous), and a Wrapper for ApiREST / Websockets. Get will start working with abstractions, and anyone will be able to extend GetInterface and create micropackages for Get, including you who are reading. Anything you find useful in your day to day, you can integrate this package. All micropackages will be inserted in the readme, and those that do not add size to the lib, or that have a greater number of downloads will be integrated into the core.

    3. I really need opinions on this: Get is currently doing the AOT compilation division. Even though everything seems to be centralized, if you don't use routes, for example, nothing of routes is compiled in the application, only what was used from Get is actually compiled. However, some things like Storage, will require plugins like "path", which will identify the file folder to write to it. What should I do about it?

    a: Create the get-core with as few dependencies as possible, without storage, internationalization, only with injection of routes, dependencies and status and add these features to Get main.

    b: Create a "get-full" with all features, and leave this package as is.

    c: try to create micropackages based on abstraction, and add them by extensions, and the integration settings must be done manually.

    I appreciate any comments.

    opened by jonataslaw 22
  • Is it possible to use Get package for apps that use CupertinoApp()?

    Is it possible to use Get package for apps that use CupertinoApp()?

    GetX package readme says:

    • Step 1: Add "Get" before your MaterialApp, turning it into GetMaterialApp

    void main() => runApp(GetMaterialApp(home: Home()));

    • Note: This step in only necessary if you gonna use route management (Get.to(), Get.back() and so on). If you not gonna use it then it is not necessary to do step 1
      

    I'm creating an app for iOS and therefore I use CupertinoApp() widget instead of MaterialApp(). And I want to use route management as well.

    Is it possible to use Get package for apps that use CupertinoApp() ?

    More info is needed Waiting for customer response Not an issue 
    opened by intraector 22
  • Unhandled Exception: setState() called after dispose()

    Unhandled Exception: setState() called after dispose()

    Describe the bug The provided code is a simplified abstraction of a bigger snippet. I have a controller that performs actions on init and updates the view, if I make the GetBuilders global parameter for all views that use the controller false and switch views while one is updating I get:

    E/flutter (23637): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: setState() called after dispose(): _GetBuilderState<TestViewModel>#0b190(lifecycle state: defunct, not mounted)
    E/flutter (23637): This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.
    E/flutter (23637): The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
    E/flutter (23637): This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().
    E/flutter (23637): #0      State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1197:9)
    E/flutter (23637): #1      State.setState (package:flutter/src/widgets/framework.dart:1232:6)
    E/flutter (23637): #2      GetxController.update.<anonymous closure> (package:get/src/state_manager/simple/get_state.dart:15:25)
    E/flutter (23637): #3      _SetBase.forEach (dart:collection/set.dart:438:30)
    E/flutter (23637): #4      GetxController.update (package:get/src/state_manager/simple/get_state.dart:14:21)
    E/flutter (23637): #5      TestViewModel.loading= (package:get_only_example/core/viewmodels/test_view_model.dart:11:5)
    E/flutter (23637): #6      TestViewModel.onInit (package:get_only_example/core/viewmodels/test_view_model.dart:20:5)
    E/flutter (23637): <asynchronous suspension>
    E/flutter (23637): #7      DisposableInterface.onStart (package:get/src/state_manager/rx/rx_interface.dart:30:5)
    E/flutter (23637): #8      _GetBuilderState.initState (package:get/src/state_manager/simple/get_state.dart:97:19)
    E/flutter (23637): #9      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4640:58)
    E/flutter (23637): #10     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
    E/flutter (23637): #11     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
    E/flutter (23637): #12     Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
    E/flutter (23637): #13     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
    E/flutter (23637): #14     Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
    E/flutter (23637): #15     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5)
    E/flutter (23637): #16     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
    E/flutter (23637): #17     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
    E/flutter (23637): #18     Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
    E/flutter (23637): #19     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
    E/flutter (23637): #20     Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
    E/flutter (23637): #21     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5)
    E/flutter (23637): #22     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
    E/flutter (23637): #23     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
    E/flutter (23637): #24     Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
    E/flutter (23637): #25     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5830:14)
    E/flutter (23637): #26     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
    E/flutter (23637): #27     Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
    E/flutter (23637): #28     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5830:14)
    E/flutter (23637): #29     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
    E/flutter (23637): #30     Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
    E/flutter (23637): #31     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
    E/flutter (23637): #32     Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
    E/flutter (23637): #33     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5)
    E/flutter (23637): #34     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
    E/flutter (23637): #35     Element.inflateWidget (package:fl
    

    To Reproduce Steps to reproduce the behavior: Run the provided code snippet.

    Expected behavior Execute without error.

    Flutter Version: 1.17.3

    Get Version: 3.4.1

    Minimal reproduce code

    import 'package:flutter/material.dart';
    import 'package:get/get.dart';
    
    import '../../core/viewmodels/test_view_model.dart';
    
    class TestView extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return GetBuilder<TestViewModel>(
          init: TestViewModel(),
          global: false,
          builder: (_) => DefaultTabController(
            length: 2,
            child: Scaffold(
              appBar: AppBar(
                title: Text('This is a test'),
                bottom: TabBar(
                  labelPadding: EdgeInsets.symmetric(vertical: 10),
                  tabs: [
                    Text('Tab 1'),
                    Text('Tab 2'),
                  ],
                ),
              ),
              body: TabBarView(
                children: [
                  _Tab1(),
                  _Tab2(),
                ],
              ),
            ),
          ),
        );
      }
    }
    
    class _Tab2 extends StatelessWidget {
      const _Tab2({
        Key key,
      }) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return GetBuilder<TestViewModel>(
          init: TestViewModel(),
          global: false,
          builder: (_) => Center(
            child: _.loading ? CircularProgressIndicator() : Text(_.text),
          ),
        );
      }
    }
    
    class _Tab1 extends StatelessWidget {
      const _Tab1({
        Key key,
      }) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return GetBuilder<TestViewModel>(
          init: TestViewModel(),
          global: false,
          builder: (_) => Center(
            child: _.loading ? CircularProgressIndicator() : Text(_.text),
          ),
        );
      }
    }
    
    import 'package:get/get.dart';
    
    class TestViewModel extends GetxController {
      String text = '';
      bool _loading = false;
    
      bool get loading => _loading;
    
      set loading(bool value) {
        _loading = value;
        update();
      }
    
      @override
      Future<void> onInit() async {
        super.onInit();
        loading = true;
        await Future.delayed(Duration(seconds: 2));
        text = 'hello';
        loading = false;
      }
    }
    
    opened by Prn-Ice 22
  • Flutter Beta - Caught error: NoSuchMethodError: The method 'pushNamedAndRemoveUntil' was called on null

    Flutter Beta - Caught error: NoSuchMethodError: The method 'pushNamedAndRemoveUntil' was called on null

    Describe the bug On start up of my app, I get this error

    [GETX] "AuthController" has been initialized
    [GETX] "GetMaterialController" has been initialized
    I/flutter ( 6822): Caught error: NoSuchMethodError: The method 'pushNamedAndRemoveUntil' was called on null.
    I/flutter ( 6822): Receiver: null
    I/flutter ( 6822): Tried calling: pushNamedAndRemoveUntil<dynamic>("/login", Closure: (Route<dynamic>) => bool, arguments: null)
    I/flutter ( 6822): stackTrace: #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
    I/flutter ( 6822): #1      GetNavigation.offAllNamed (package:get_navigation/src/extension_navigation.dart:262:36)
    I/flutter ( 6822): #2      AuthController.checkLoggedIn (package:SureVoIPTalk/src/controller/auth.dart:72:11)
    I/flutter ( 6822): #3      ever.<anonymous closure> (package:get_rx/src/rx_workers/rx_workers.dart:47:42)
    I/flutter ( 6822): #4      _rootRunUnary (dart:async/zone.dart:1198:47)
    I/flutter ( 6822): #5      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
    I/flutter ( 6822): #6      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
    I/flutter ( 6822): #7      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
    I/flutter ( 6822): #8      _DelayedData.perform (dart:async/stream_impl.dart:611:14)
    I/flutter ( 6822): #9      _StreamImplEvents.handleNext (dart:async/stream_impl.dart:730:11)
    I/flutter ( 6822): #10     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:687:7)
    I/flutter ( 6822): #11     _rootRun (dart:async/zone.dart:1182:47)
    I/flutter ( 6822): #12     _CustomZone.run (dart:async/zone.dart:1093:19)
    I/flutter ( 6822): #13     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
    I/flutter ( 6822): #14     _Custo
    I/flutter ( 6822): In dev mode. Not sending report to Sentry.io.
    [GETX] GOING TO ROUTE /login
    [GETX] REMOVING ROUTE /
    

    Expected behavior No error

    Flutter Version: [✓] Flutter (Channel beta, 1.22.0-12.1.pre, on Linux, locale en_GB.UTF-8)

    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [✓] Chrome - develop for the web [✓] Android Studio (version 3.6) [✓] VS Code (version 1.49.0) [✓] Connected device (4 available)

    Getx Version: 3.11.1

    Describe on which device you found the bug: sdk gphone API 30

    Minimal reproduce code

    AuthController

      @override
      void onInit() {
        ever(isLoggedIn, checkLoggedIn);
        _loadLoggedIn();
        _loadUserDetails();
      }
    
      @override
      void onReady() {
        checkLoggedIn(null);
        super.onReady();
      }
    
      void checkLoggedIn(_) {
        if (isLoggedIn.value) {
          Get.offNamed("/home");
        } else {
          Get.offAllNamed("/login");
        }
      }
    

    app.dart:

              home: SplashScreen(),
              getPages: [
                GetPage(
                    name: "/home",
                    page: () => HomeScreen(),
                    binding: HomeBinding()),
                GetPage(name: "/login", page: () => LoginScreen()),
                GetPage(name: "/dialpad", page: () => DialpadScreen())
              ],
            ));
    
    invalid Waiting for customer response Without a valid reproduction code 
    opened by ghenry 20
  • This package uses code from i18n_extension without proper attribution

    This package uses code from i18n_extension without proper attribution

    Hi Jonataslaw,

    You copied the idea and code from my translations library https://pub.dev/packages/i18n_extension into his package, with no attribution whatsoever.

    Changed my extension from .i18n to his .tr, simplified a few things, removed a few features, changed names, and this is it.

    Open source is free, but it doesn't mean you can base your code in other people's code without attribution.

    It seems to be a recurring problem with this project: https://github.com/jonataslaw/getx/issues/509

    opened by marcglasberg 20
  • a页面跳转b, 再从b回a, a的图片会刷新(即使保持了页面状态)

    a页面跳转b, 再从b回a, a的图片会刷新(即使保持了页面状态)

    a页面跳转b, 再从b回a, a的图片会刷新(即使保持了页面状态)

    opened by ximenqing183 1
  • Add the followRedirects and maxRedirects fields to the Request object…

    Add the followRedirects and maxRedirects fields to the Request object…

    … in the GetConnect _get method

    Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

    Every PR must update the corresponding documentation in the code, and also the readme in english with the following changes.

    Pre-launch Checklist

    • [ ] I updated/added relevant documentation (doc comments with ///).
    • [ ] I added new tests to check the change I am making or feature I am adding, or @jonataslaw said the PR is test-exempt.
    • [ ] All existing and new tests are passing.
    opened by wei53881 0
  • [edited] We added PageRoute argument into CustomTransition.buildTransition

    [edited] We added PageRoute argument into CustomTransition.buildTransition

    We added PageRoute argument into CustomTransition.buildTransition. This provides a complex way to create custom transitions

    There is no elements to change at README.md

    Pre-launch Checklist

    • [x] I updated/added relevant documentation (doc comments with ///).
    • [x] I added new tests to check the change I am making or feature I am adding, or @jonataslaw said the PR is test-exempt.
    • [x] All existing and new tests are passing.
    opened by rossa-mx 2
  • GetNotifier / StateMixin issues

    GetNotifier / StateMixin issues

    GetX has Bloc-alike state management solution, with GetNotifier or StateMixin. But I dislike how it is currently implemented.

    1. It works only with GetView and controller.obx { } block It cannot re-render the parts of the view, only the whole view.
    2. It doesn't support multiple controllers. I can have two Blocs: say, the page logic and form validation logic. But I can have only 1 controller.obx due to GetView limitation.
    3. It doesn't have a Selector analogue. controller.obx will rebuild on any changes in the state. Consider adding filter property (as in GetBuilder). The possible solution is to get rid of this "controller.obx { }" functional syntax, and change it to the normal Widget (like BlocSelector).

    Also, I'm unhappy with RxStatuses.

    1. For example, RxStatus.loading() — why does it have the parenthesis (looks like you create some instance)? It could be a simple enum RxStatus.loading;
    2. Rx prefix makes you think, that it's a reactive field — but it's not. It doesn't have a .value property, and you cannot watch its changes with Obx widget. So if I want to use it as a reactive field, it will be an ugly statement Rx<RxStatus>

    Consider either

    1. making it reactive
    2. or rename it to StateStatus
    opened by subzero911 1
  • Extension for elevating widgets

    Extension for elevating widgets

    added new extension in widget_extension.dart which provide elevation to the Widget

    Pre-launch Checklist

    • [x] I updated/added relevant documentation (doc comments with ///).
    • [x] I added new tests to check the change I am making or feature I am adding, or @jonataslaw said the PR is test-exempt.
    • [x] All existing and new tests are passing.
    opened by tosif91 0
  • How to implement such routing,Local navigation?

    How to implement such routing,Local navigation?

    How to use GetX to do routing like this???

    20200527065220725

    opened by Dboy233 0
  • default decoder get connect not working

    default decoder get connect not working

    Describe the bug httpClient.defaultDecoder not working when i use getconnect. when i try to access a list of map in json, the code

     if (map is List)
            return map.map((item) => Tagihan.fromJson(item)).toList(); 
    

    not working, so i must do it straight inside future get.

    **Reproduction code

    import 'package:get/get.dart';
    import 'package:get/get_connect/http/src/request/request.dart';
    import 'package:shared_preferences/shared_preferences.dart';
    
    import '../tagihan_model.dart';
    
    class TagihanProvider extends GetConnect {
      @override
      void onInit() {
        httpClient.defaultDecoder = (map) {
          if (map is Map<String, dynamic>) return Tagihan.fromJson(map);
          if (map is List)
            return map.map((item) => Tagihan.fromJson(item)).toList();
        };
        httpClient.addRequestModifier((Request request) async {
          final SharedPreferences _prefs = await SharedPreferences.getInstance();
          final String? _getToken = _prefs.getString('token');
          request.headers['Authorization'] = "Bearer $_getToken";
          return request;
        });
        httpClient.baseUrl = 'http://URL';
      }
    
      // Get Tagihan
      Future<Response<Tagihan>> getTagihan() async {
        return get(
          '/tagihans',
          decoder: (obj) => Tagihan.fromJson(obj[0]),
        );
      }
    }
    
    

    To Reproduce Steps to reproduce the behavior:

    1. Go to debug
    2. See error

    Expected behavior decoder must return list of map but it say type 'list dynamic ' is not a subtype of type 'map string dynamic '

    Screenshots If applicable, add screenshots to help explain your problem.

    Flutter Version: 2.5.3

    Getx Version: 4.3.8

    Describe on which device you found the bug: Redmi Note 9 Pro - Android

    Minimal reproduce code Provide a minimum reproduction code for the problem

    opened by gintoki05 1
  • nav2 Nested routing working is not expected

    nav2 Nested routing working is not expected

    Please check this repo https://github.com/q876625596/getx_nav2_example

    The HomeView and the SecondView are both child routes,

    When I use Get.rootDelegate.toName (Routes.SECOND), This HomeView was destroyed, and the log is output: [GETX] "HomeLogic" onDelete () called [GETX] "HomeLogic" deleted from memory.

    But I want HomeView not to be destroyed when I go from HomeView to SecondView,

    please help me @ahmednfwela

    opened by q876625596 9
  • nullsafe of ValueBuilder

    nullsafe of ValueBuilder

    type '(BookmarkedFilter, (BookmarkedFilter) => void) => ExtendedNestedScrollView' is not a subtype of type '(BookmarkedFilter?, (BookmarkedFilter?) => void) => Widget' image Need to be changed like this to use image It should not be mandatory image

    opened by xiao-cao-x 0
  • arguments parameter for Get.bottomSheet()

    arguments parameter for Get.bottomSheet()

    There is argument parameter in Get.dialog but not in bottomSheet. It would be good to implement the same way.

    opened by worawutt 0
Releases(4.5.1)
  • 4.5.1(Nov 29, 2021)

    [4.5.1] - Fix Snackbar when it have action and icon the same time

    [4.5.0] - Big Update To have a context-free, page-agnostic snackbar, we used OverlayRoute to display a partial route. However this had several problems:

    1: There was no possibility to close the page without closing the snackbar 2: Get.back() could cause problems with tests of Get.isSnackbarOpen not being properly invoked 3: Sometimes when using iOS popGesture with an open snackbar, some visual inconsistency might appear. 4: When going to another route, the snackbar was not displayed on the new page, and if the user clicked on the new route as soon as he received a Snackbar, he could not read it.

    We remade the Snackbar from scratch, having its Api based on Overlay, and now opening a Snackbar won't be tied to a route, you can normally navigate routes while a Snackbar is shown at the top (or bottom), and even the PopGesture of the iOS is not influenced by it.

    Using Get.back() is handy, it's a small command, which closes routes, dialogs, snackbars, bottomsheets, etc, however Getx 5 will prioritize code safety, and splitting will reduce the check code as well. Currently we have to check if a snackbar is open, to close the snackbar and prevent the app from going back a page, all this boilerplate code will be removed, at the cost of having what it closes in front of Get.back command.

    For backwards compatibility, Get.back() still works for closing routes and overlays, however two new commands have been added: Get.closeCurrentSnackbar() and Get.closeAllSnackbars(). Maybe we will have a clearer api in GetX 5, and maybe Get.back() will continue to do everything like it does today. The community will be consulted about the desired api. However version 5 will definitely have commands like: Get.closeCurrentSnackbar, Get.closeCurrentDialog etc. There is also the possibility to close a specific snackbar using the return of Get.snackbar, which will no longer return a void, and now return a SnackbarController.

    Snackbars now also have a Queue, and no longer stack one on top of the other, preventing viewing. GetX now has flexible, customizable, route-independent, and completely stable Snackbars.

    Fixed bugs where the snackbar showed an error in debug mode for a fraction of a second. We found that Flutter has a bug with blur below 0.001, so we set the minimum overlayBlur value to this value if it is ==true.

    Errors with internationalization were also fixed, where if you are in UK, and the app had the en_US language, you didn't have American English by default. Now, if the country code is not present, it will automatically fetch the language code before fetching a fallbackLanguage.

    Update locale also now returns a Future, allowing you to perform an action only when the language has already changed (@MHosssam)

    We are very happy to announce that GetX is now documented in Japanese as well, thanks to (@toshi-kuji)

    GetX has always been focused on transparency. You can tell what's going on with your app just by reading the logs on the console. However, these logs shouldn't appear in production, so it now only appears in debug mode (@maxzod)

    @maxzod has also started translating the docs into Arabic, we hope the documentation will be complete soon.

    Some remaining package logs have been moved to Get.log (@gairick-saha)

    RxList.removeWhere received performance optimizations (@zuvola)

    Optimizations in GetConnect and added the ability to modify all request items in GetConnect (@rodrigorahman)

    The current route could be inconsistent if a dialog were opened after a transition, fixed by @xiangzy1

    Fixed try/catch case missed in socket_notifier (@ShookLyngs)

    Also we had fixes in the docs: @DeathGun3344 @pinguluk

    GetX also surpassed the incredible mark of more than 7000 likes, being the most liked package in all pub.dev, went from 99% to 100% popularity, and has more than 5.3k stars on github. Documentation is now available in 12 languages, and we're happy for all the engagement from your community.

    This update is a preparation update for version 5, which will be released later this year.

    Breaking and Depreciation: GetBar is now deprecated, use GetSnackbar instead. dismissDirection now gets a DismissDirection, making the Snackbar more customizable.

    Source code(tar.gz)
    Source code(zip)
  • 4.2.0(Jul 20, 2021)

    [4.2.0] - Big update

    This update fixes important bugs as well as integrates with Navigator 2. It also adds GetRouterOutlet, similar to angular RouterOutlet thanks to @ahmednfwela. Also, the documentation translation for Vietnamese (@khangahs) has been added, making the GetX documentation available for 11 different languages, which is just fantastic for any opensource project. GetX has achieved more than 5.4k likes from the pub, and more than 4k stars on github, has videos about it with 48k on youtube, and has communities in the 4 hemispheres of the earth, besides having a large list of contributors as you see bellow. We're all happy to facilitate development with dart and flutter, and that making programming hassle-free has been taken around the world.

    Changes in this version:

    • Fix: Navigating to the same page with Get.offNamed does not delete the controller from that page using Get.lazyPut.

    • Fix Readme GetMiddleware typos by @nivisi

    • Fix url replace error by @KevinZhang19870314

    • Changed response default encoding from latin1 to utf8 by @heftekharm

    • Add Duration in ExtensionBottomSheet by @chanonpingpong

    • Added compatibility with dart-lang/mockito by @lifez

    • Added extensions methods to convert value in percent value by @kauemurakami

    • Set darkTheme equal theme when darkTheme is null by @eduardoFlorence

    • Add padding to 'defaultDialog' by @KevinZhang19870314

    • GraphQLResponse inherit Response info by @jasonlaw

    • Fix Redundant concatenating base url by @jasonlaw

    • Add content type and length into the headers when the content type is 'application/x-www-form-urlencoded' by @calvingit

    • Make withCredentials configurable by @jasonlaw

    • Fix flutter 2.0 error by @yunchiri

    • Allow deleting all registered instances by @lemps

    • Refactor/rx interface notify children @by kranfix

    • Fixed parameter parsing and middleware sorting by @ahmednfwela

    • Improvements to router outlet by @ahmednfwela

    • Minor improvements and bug fixes by @ahmednfwela

    • Adding route guards and improving navigation by @ahmednfwela

    • Fix RxInterface.proxy losing its previous value on exception by @WillowWisp

    • Added dispose() for bottomSheet. by @furkankurt

    • Added Pull request template by @unacorbatanegra

    • Fix and update documentation: @Farid566, @galaxykhh, @arslee07, @GoStaRoff, @BondarenkoArtur, @denisrudnei, @Charly6596, @nateshmbhat, @hrithikrtiwari, @Undeadlol1, @rws08, @inuyashaaa, @broccolism, @aadarshadhakalg, @ZeroMinJeon

    Source code(tar.gz)
    Source code(zip)
  • 3.25.0(Feb 12, 2021)

    • Added [reload] and [reloadAll] methods to reload your Controller to original values
    • Added [FullLifeCycleController] - A GetxController capable of observing all the life cycles of your application. FullLifeCycleController has the life cycles:
      • onInit: called when the controller enters the application's memory
      • onReady: called after onInit, when build method from widget relationed to controller is done.
      • onClose: called when controller is deleted from memory.
      • onPaused: called when the application is not currently visible to the user, and running in the background.
      • onInactive: called when the application is in an inactive state and is not receiving user input, when the user receives a call, for example
      • onResumed: The application is now visible and in the foreground
      • onDetached: The application is still hosted on a flutter engine but is detached from any host views.
      • didChangeMetrics: called when the window size is changed
    • Added SuperController, a complete life circle controller with StateMixin
    • Improve Iterable Rx Api. Now, you can to use dart List, Map and Set as reactive, like: List names = ['juan', 'pedro', 'maria'].obs;
    • Added assign and assignAll extensions to default dart List
    • Added parameters options from Get.toNamed, Get.offNamed, and Get.offAllNamed (@enghitalo)
    • Improve Rx disposal logic to completely prevent memory leaks
    • Improve Capitalize methods from GetUtils (@eduardoflorence)
    • Prevent a close snackbar from close a Screen with double tap (@eduardoflorence)
    • Includes GetLifeCycleBase mixin on delete/dispose (@saviogrossi)
    • Added internacionalization example to sample app (@rodriguesJeff)
    • Added headers to Graphql query and mutation(@asalvi0)
    • Added translation with parameter extension (@CpdnCristiano)
    • Added Get.parameter access to Middleware (@eduardoflorence)
    • Fix RxBool typo (@emanuelmutschlechner)
    • Added Filter to GetBuilder
    • Added debouce to GetBuilder update
    • Added ability to insert an Enum, class, or type of an object as a GetBuilder's Id
    • Improve upload time from GetConnect
    • Create minified version to DartPad(@roipeker)
    • Suggested to use Get.to(() => Page()) instead of Get.to(Page()).
    • Added more status codes to GetConnect (@romavic)
    • Fix and improve docs: @unacorbatanegra, @lsm, @nivisi, @ThinkDigitalSoftware, @martwozniak, @UsamaElgendy, @@DominusKelvin, @jintak0401, @goondeal
    Source code(tar.gz)
    Source code(zip)
  • 3.21.0(Nov 29, 2020)

    • This update attaches two nice features developed by (@SchabanBo): GetPage Children And GetMiddleware In previous versions, to create child pages, you should do something like:
    GetPage(
      name: '/home',
      page: () => HomeView(),
      binding: HomeBinding(),
    ),
    GetPage(
      name: '/home/products',
      page: () => ProductsView(),
      binding: ProductsBinding(),
    ),
    GetPage(
      name: '/home/products/electronics',
      page: () => ElectronicsView(),
      binding: ElectronicsBinding(),
    ),
    

    Although the feature works well, it could be improved in several ways: 1- If you had many pages, the page file could become huge and difficult to read. Besides, it was difficult to know which page was the daughter of which module. 2- It was not possible to delegate the function of naming routes to a subroutine file. With this update, it is possible to create a declarative structure, very similar to the Flutter widget tree for your route, which might look like this:

    GetPage(
          name: '/home',
          page: () => HomeView(),
          binding: HomeBinding(),
          children: [
            GetPage(
                name: '/products',
                page: () => ProductsView(),
                binding: ProductsBinding(),
                children: [
                  GetPage(
                     name: '/electronics',
                     page: () => ElectronicsView(),
                     binding: ElectronicsBinding(),
                  ),
                ],
              ),
          ], 
      );
    

    Thus, when accessing the url: '/home/products/electronics' Or use Get.toNamed('/home/products/electronics') it will go directly to the page [ElectronicsView], because the child pages, automatically inherit the name of the ancestral page, so with any small change on any father in the tree all children will be updated. If you change [/products] to [/accessories], you don't nesse update on all child links.

    However, the most powerful feature of this version is GetMiddlewares. The GetPage has now new property that takes a list of GetMiddleWare than can perform actions and run them in the specific order.

    Priority

    The Order of the Middlewares to run can pe set by the priority in the GetMiddleware.

    final middlewares = [
      GetMiddleware(priority: 2),
      GetMiddleware(priority: 5),
      GetMiddleware(priority: 4),
      GetMiddleware(priority: -8),
    ];
    

    those middlewares will be run in this order -8 => 2 => 4 => 5

    Redirect

    This function will be called when the page of the called route is being searched for. It takes RouteSettings as a result to redirect to. Or give it null and there will be no redirecting.

    GetPage redirect( ) {
      final authService = Get.find<AuthService>();
      return authService.authed.value ? null : RouteSettings(name: '/login')
    }
    

    onPageCalled

    This function will be called when this Page is called before anything created you can use it to change something about the page or give it new page

    GetPage onPageCalled(GetPage page) {
      final authService = Get.find<AuthService>();
      return page.copyWith(title: 'Welcome ${authService.UserName}');
    }
    

    OnBindingsStart

    This function will be called right before the Bindings are initialize. Here you can change Bindings for this page.

    List<Bindings> onBindingsStart(List<Bindings> bindings) {
      final authService = Get.find<AuthService>();
      if (authService.isAdmin) {
        bindings.add(AdminBinding());
      }
      return bindings;
    }
    

    OnPageBuildStart

    This function will be called right after the Bindings are initialize. Here you can do something after that you created the bindings and before creating the page widget.

    GetPageBuilder onPageBuildStart(GetPageBuilder page) {
      print('bindings are ready');
      return page;
    }
    

    OnPageBuilt

    This function will be called right after the GetPage.page function is called and will give you the result of the function. and take the widget that will be showed.

    OnPageDispose

    This function will be called right after disposing all the related objects (Controllers, views, ...) of the page.

    Source code(tar.gz)
    Source code(zip)
  • 3.20.0(Nov 28, 2020)

    • Added GetConnect.
    • GetConnect is an easy way to communicate from your back to your front. With it you can:
    • Communicate through websockets
    • Send messages and events via websockets.
    • Listen to messages and events via websockets.
    • Make http requests (GET, PUT, POST, DELETE).
    • Add request modifiers (like attaching a token to each request made).
    • Add answer modifiers (how to change a value field whenever the answer arrives)
    • Add an authenticator, if the answer is 401, you can configure the renewal of your JWT, for example, and then it will again make the http request.
    • Set the number of attempts for the authenticator
    • Define a baseUrl for all requests
    • Define a standard encoder for your Model.
    • Note1: You will never need to use jsonEncoder. It will always be called automatically with each request. If you define an encoder for your model, it will return the instance of your model class ALREADY FILLED with server data.
    • Note2: all requests are safety, you do not need to insert try/catch in requests. It will always return a response. In case of an error code, Response.hasError will return true. The error code will always be returned, unless the error was a connection error, which will be returned Response.hasError, but with error code null.
    • These are relatively new features, and also inserted in separate containers. You don't have to use it if you don't want to. As it is relatively new, some functions, such as specific http methods, may be missing.
    • Translation to Korean (@rws08)
    • Fix Overlays state (@eduardoflorence)
    • Update chinese docs (@jonahzheng)
    • Added context.isDarkMode to context extensions
    Source code(tar.gz)
    Source code(zip)
  • 3.17.1(Nov 20, 2020)

  • 3.7.0(Sep 1, 2020)

    • Added: RxSet. Sets can now also be reactive.
    • Improve GetPlatform: It is now possible to know which device the user is using if GetPlatform.isWeb is true. context.responsiveValue used device orientation based on web and non-web applications. Now it checks if it is a desktop application (web or desktop application) to do the responsiveness calculation.
    • Change: The documentation previously stated that Iterables should not access the ".value" property. However, many users did not pay attention to this fact, and ended up generating unnecessary issues and bugs in their application. In this version, we focus on code security. Now ".value" is protected, so it cannot be accessed externally by Lists, Maps or Sets.
    • Change: Observable lists are now Dart Lists. There is no difference in your use: RxList list = [].obs; And you use List list = [].obs;
    • Change: You do not need to access the ".value" property of primitives. For Strings you need interpolation. For num, int, double, you will have the normal operators, and use it as dart types. This way, .value can be used exclusively in ModelClasses. Example:
    var name = "Jonny" .obs;
    // usage:
    Text ("$name");
    
    var count = 0.obs;
    // usage:
    increment() => count ++;
    Text("$count");
    

    Thus: List, Map, Set, num, int, double and String, as of this release, will no longer use the .value property.

    NOTE: The changes were not break changes, however, you may have missed the details of the documentation, so if you faced the message: "The member 'value' can only be used within instance members of subclasses of 'rx_list.dart' "you just need to remove the" .value "property from your list, and everything will work as planned. The same goes for Maps and Sets.

    Source code(tar.gz)
    Source code(zip)
  • 3.1.2(Jun 30, 2020)

  • 3.1.0(Jun 27, 2020)

  • 3.0.1(Jun 26, 2020)

    Breaking changes on Rx api and GetController and RxController were merged, and now you only have the 'GetxController' Refactor routing system. Now you can add custom transitions and more Improved the use of dynamic routes, you can now define two different pages according to your arguments. Added GetView widget Added internacionalization Added validations Added Get queqe Added GetStorage (with separated package) Minor bug fixes.

    Source code(tar.gz)
    Source code(zip)
  • 2.11.0(Jun 6, 2020)

    • Added Permissions: You can now revoke permissions to SmartManagement so that it cannot delete a particular controller. Add to Get.put (Controller(), permanent: true); to make it indelible. Get.lazyPut () will not receive this resource. Initially he had it, but we saw in internal tests that it could cause problems with the bindings API. Bindings were created to initialize and delete an instance, if it were allowed to make a controller started with lazyPut permanent, copies of that Controller would be created every time Binding was called. For the safety of users, especially new users who could easily do this, it was decided that this feature will only be present in Get.put.
    • Improve: Now a controller's life cycle has no connection with the View life cycle. It is no longer called internally in an "initState", it is now called when the Controller enters memory. This means that now onInit will always be called, regardless of where you started your dependency.
    • removed: this property of the update() method has been permanently removed.
    Source code(tar.gz)
    Source code(zip)
  • 2.10.3(Jun 4, 2020)

Owner
Jonny Borges
Full Stack Developer and Lawyer. Specialist in CyberSecurity, and CyberneticLaw. I'm living a romance with Dart now.
Jonny Borges
A simple and easy to learn declarative navigation framework for Flutter, based on Navigator 2.0.

A simple and easy to learn declarative navigation framework for Flutter, based on Navigator 2.0 (Router). If you love Flutter, you would love declarat

Zeno Nine 15 Oct 24, 2021
Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.

Jonny Borges 5.3k Nov 21, 2021
Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.

Languages: English (this file), Indonesian, Urdu, Chinese, Brazilian Portuguese, Spanish, Russian, Polish, Korean, French. About Get Installing Counte

Jonny Borges 5.3k Nov 24, 2021
A Flutter application to easily manage and control your Algorand nodes.

Algorand Node Companion App Algorand Node Companion App is a mobile, web and desktop application that can manage, operate and track the status of your

Tomas Verhelst 13 Oct 15, 2021
Simple tool to open WhatsApp chat without saving the number, developed using Google's Flutter Framework. for Android/ IOS/ Desktop/ Web

OpenWp Simple tool to open WhatsApp chat without saving the number Explore the docs » View Demo · Report Bug · Request Feature Table of Contents About

Swarup Bhanja Chowdhury 14 Aug 8, 2021
Flutter Shine is a library for pretty and realistic shadows, dynamic light positions, extremely customizable shadows, no library dependencies, text or box shadows based on content.

Flutter Shine Show some ❤️ and star the repo to support the project Flutter widget inspired by Shine Installation Add the Package dependencies: flut

Jonathan Monga 137 Nov 26, 2021
FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to feel like part of the Flutter framework.

File Manager FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to fee

Devs On Flutter 28 Nov 12, 2021
Flutter: Overriding Dependencies | Solving Version Conflicts | Solving Version Conflicts

flutterutils A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Pawan Kumar 49 Nov 18, 2021
Transform ML models into a native code (Java, C, Python, Go, JavaScript, Visual Basic, C#, R, PowerShell, PHP, Dart, Haskell, Ruby) with zero dependencies

m2cgen m2cgen (Model 2 Code Generator) - is a lightweight library which provides an easy way to transpile trained statistical models into a native cod

Bayes' Witnesses 1.9k Nov 25, 2021
A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed apps.

Flutter AppAvailability Plugin A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed a

Lorenzo Pichilli 80 Nov 2, 2021
A personal app to track and manage your expenses.

?? Batua ?? A Personal App to track and manage your expenses! Batua is the best money manager and daily expense tracker to automatically and securely

Pratyush M 37 Oct 31, 2021
The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.

The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs. Inspired by SwiftGen. Motivation Using asset path str

FlutterGen 790 Nov 28, 2021
Create TODO LIST with Get Storage !

todo-list-get-storage Create TODO LIST with Get Storage ! dependencies: flutter: sdk: flutter # The following adds the Cupertino Icons font

Kauê Murakami 9 Oct 26, 2021
This Android/IOS application intends to help users to get an early notification for slot availability for Covid19 vaccination.

Cowin Slot Reminder Objective: This Android/IOS application intends to help users to get an early notification for slot availability for Covid19 vacci

null 4 Jun 6, 2021
Chuanying - what you see is what you get. 传影--所见即所得

传影--所见即所得 简介 从前 想要制作证件照,需要先把图片用QQ传到电脑,再用PS手动抠图; 看到一句喜欢的话,想要记到电脑里,需要一个字一个字用键盘打出来; 看到黑板上老师写的公式,想要记到Word里,需要用MathType一点点打出来; 但是有没有可能,只用手机拍照,就能搞定上面所有的事,一步

null 15 Aug 7, 2021
Flutter Version Management: A simple CLI to manage Flutter SDK versions.

fvm Flutter Version Management: A simple cli to manage Flutter SDK versions. FVM helps with the need for a consistent app builds by allowing to refere

Leo Farias 2.2k Nov 26, 2021
Manage the state of your widgets using imperative programming concepts.

Imperative Flutter Manage the state of your widgets using imperative programming concepts. Setup Intall imperative_flutter package in pubspec.yaml dep

Jeovane Santos 4 Apr 23, 2021
A Flutter package to manage feature flagging.

feature_flags This package simply allows you to activate dynamically functionnalities of your app. Usage Setup Wrap your app's widget in a Features wi

Aloïs Deniel 7 Sep 30, 2021
A code generator to write widgets as function without loosing the benefits of classes.

Widgets are cool. But classes are quite verbose: class Foo extends StatelessWidget { final int value; final int value2; const Foo({Key key, thi

Remi Rousselet 429 Nov 16, 2021
Forms in Flutter without hassle!

Super Form Quick, familiar and extensible forms in Flutter ?? No magical configuration required ?? Managing form state with standard Flutter forms can

Bartosz Wiśniewski 7 Nov 5, 2021
Android App written with Flutter/Dart to navigate medium.com without limitations.

Medium Unlimited An Android application written with Flutter/Dart to read medium.com without limitations. Features Read medium without reading limits

null 13 Nov 21, 2021
Platform to post/say something without sharing personal information.

Anon is an Open Source Application where it's users will be able to share their thoughts without their identity being revealed i.e Anonymous. When the

Ismael Shakverdiev 16 Oct 22, 2021
An architecture for dynamic UI without client deployment

Server Driven UI Demo Server Driven UI(SDUI)는 서버에서 클라이언트의 UI 컴포넌트를 관리하는 방식. 클라이언트 배포없이 API 응답을 변경하는 것만으로 UI 변경이 가능한 동시에 하위 호환성을 확보할 수 있다. Rust, GraphQ

Simon Park 9 Jul 10, 2021
A Flutter plugin to easily handle realtime location in iOS and Android. Provides settings for optimizing performance or battery.

Flutter Location Plugin This plugin for Flutter handles getting location on Android and iOS. It also provides callbacks when location is changed. Gett

Guillaume Bernos 832 Nov 28, 2021
Easily add staggered animations to your ListView, GridView, Column and Row children.

Flutter Staggered Animations Easily add staggered animations to your ListView, GridView, Column and Row children as shown in Material Design guideline

null 960 Nov 26, 2021
A Dart package to web scraping data from websites easily and faster using less code lines.

Chaleno A flutter package to webscraping data from websites This package contains a set of high-level functions that make it easy to webscrap websites

António Nicolau 15 Oct 29, 2021
Minimal Unsplash Android App to easily search and download images

Minimal Unsplash Android App to easily search and download images

Yash Garg 11 Sep 28, 2021
A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully & easily modifiable.

A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully

Muhammad Hamza 17 Sep 14, 2021