Skip to content

Releases: jonataslaw/getx

Getx 3.21.0

29 Nov 17:01
Compare
Choose a tag to compare
  • 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.

getx 3.20.0

28 Nov 19:46
Compare
Choose a tag to compare
  • 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.

GetX 3.17.1

20 Nov 16:47
3475d56
Compare
Choose a tag to compare

Allow list.assignAll, map.assignAll and set.assignAll operate with null values

Getx 3.16.0

10 Nov 00:54
Compare
Choose a tag to compare
update to 3.16.0

Getx 3.15.0

25 Oct 20:15
Compare
Choose a tag to compare
update to 3.15.0

Getx 3.13.2

09 Oct 22:51
Compare
Choose a tag to compare
update to 3.13.2

Getx 3.10.2

10 Sep 15:01
0f604cb
Compare
Choose a tag to compare
Merge pull request #588 from Grohden/chore/fix-example

chore: Fix example app (missing activity)

Getx 3.10

09 Sep 21:32
Compare
Choose a tag to compare
3.10.0

update to Getx 3.10

Getx 3.7.0

01 Sep 13:12
Compare
Choose a tag to compare
  • 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.

Getx 3.6.2

30 Aug 15:12
Compare
Choose a tag to compare
update to 3.6.2