A Dart package which simulates pass by reference feature

Overview

Reference Wrapper is a Dart package which simulates pass by reference feature using Wrapper class which holds the value.

Usage

Use this package if you are calling a function that needs to modify its arguments

There are two ways to read / write the value

var x = Ref<num?>(null);
var read1 = x.ref;      // first way to read
var read2 = x();        // second way to read

x.ref = 10;             // first way to write
x(10);                  // second way to write

Example

void twice(Ref<num> x, Ref<num> y) {
  x.ref *= 2;
  y.ref *= 2;
}

void test() {
  var x = Ref<num>(5);
  var y = Ref<num>(7);

  twice(x, y);
  print(x.ref); // 10
  print(y.ref); // 14
}

Advanced Example

void twice(Ref<num> x, Ref<num> y) {
  x(x() * 2);
  y(y() * 2);
}

void test() {
  var x = Ref<num>(5);
  var y = Ref<num>(7);

  twice(x, y);
  print(x()); // 10
  print(y()); // 14
}
You might also like...

A degital diary with key feature of saving your thoughts with image

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

Nov 13, 2021

Full Feature Todos Flutter Mobile app with fireStore integration.

Full Feature Todos Flutter Mobile app with fireStore integration.

IONICFIREBASEAPP DOWNLOAD TODO APP Marketplace for Mobile app and Backend that developed on leading Enterprise Technologies with as well as with your

Nov 4, 2022

News App developed with Flutter featuring beautiful UI, category-based news, story for faster news reading, inbuilt article viewer, share feature, and more.

News App developed with Flutter featuring beautiful UI, category-based news, story for faster news reading, inbuilt article viewer, share feature, and more.

Ariel News App developed with Flutter featuring beautiful UI, category-based news, story for faster news reading, inbuilt article viewer, share featur

Nov 9, 2022

A simple way to share Instagram stories as an embedded feature within the Flutter application

Loopi Share A simple way to share Instagram stories as an embedded feature within the Flutter application. Introduction Words on both platforms Androi

Sep 24, 2022

Feature discavery based on material design

feature_discovery This Flutter package implements Feature Discovery following the Material Design guidelines. With Feature Discovery, you can add cont

Dec 15, 2022

A feature-rich cross-platform webview using webview_flutter for mobile and iframe for web. JS interop-ready.

A feature-rich cross-platform webview using webview_flutter for mobile and iframe for web. JS interop-ready.

A feature-rich cross-platform webview using webview_flutter for mobile and iframe for web. JS interop-ready. Getting started Gallery Basic usage Featu

Mar 17, 2022

Flutter project template with BloC architecture. Implemented many feature as stated in README

Flutter project template with BloC architecture. Implemented many feature as stated in README

Flutter Project Template Using BloC Implementations Theme switching Advanced Routing Bloc Observer for debugging Hydrated Cubit for holding value even

Dec 10, 2022

Keep track of college events of various boards in a single app along with personal to-do list feature.

Keep track of college events of various boards in a single app along with personal to-do list feature.

Jun 16, 2022

SIMPLE TODO APP WITH FEATURE WISE FOLDER STRUCTURE

SIMPLE TODO APP WITH FEATURE WISE FOLDER STRUCTURE

SIMPLE TODO APP WITH FEATURE WISE FOLDER STRUCTURE

May 13, 2022
Releases(v1.0.0)
Owner
null
This package gives you lock screen or pass code page

Flutter Pass Code Page or Pin Code Page Package This package gives you beautiful pass code page for using both android and ios. Demo Finger Print Usag

Yasin ilhan 61 Aug 22, 2022
Deepak Sharma 149 Dec 10, 2022
An address search field which helps to autocomplete an address by a reference

Address Search Field Widget builders to create 'address search widgets' which helps to autocomplete an address using a reference. They can be used to

Jose Luna 13 Aug 14, 2022
App that simulates a flow of screens for the course of navigation and routes with nuvigator through Flutter

Rotas app App que simula um fluxo de telas para o curso de navegação e rotas com

Heliomar P. Marques 1 Dec 19, 2021
Teste02 sds escribo - A flutter application that simulates the Indian game "Snakes and Ladders"

Seleção de Desenvolvedor de Software - Escribo Teste Técnico 02 Instruções para

Pablo Henrique 2 Feb 4, 2022
The reference implementation of Sass, written in Dart.

A Dart implementation of Sass. Sass makes CSS fun again. Using Dart Sass From Chocolatey or Scoop (Windows) From Homebrew (macOS) Standalone From npm

Sass 3.4k Jan 5, 2023
A reference credential wallet built on Flutter and DIDKit.

Check out the Credible documentation here. Credible Credible is a native mobile wallet that supports W3C Verifiable Credentials and Decentralized Iden

Spruce Systems, Inc. 31 Nov 7, 2022
A reference app in flutter using the BLoC pattern.

flutter_dice A sample Flutter app that shows how to manage responsive state using the provider pattern. Concepts Illustrated Provider pattern Using a

CodeGrue 74 Nov 18, 2022
Call Kit is a prebuilt feature-rich call component, which enables you to build one-on-one and group voice/video calls into your app with only a few lines of code.

Call Kit (ZegoUIKitPrebuiltCall) Call Kit is a prebuilt feature-rich call component, which enables you to build one-on-one and group voice/video calls

ZEGOCLOUD 9 Dec 26, 2022
Rules - Powerful and feature-rich validation library for both Dart and Flutter.

Introduction Rules - Powerful and feature-rich validation library for both Dart and Flutter. Rules is a simple yet powerful and feature-rich validatio

Ganesh Rathinavel 24 Dec 12, 2022