1,902 questions
0
votes
2
answers
94
views
Interface calculated getters [duplicate]
Just getting in to interfaces and I can't seem to find how to implement calculated fields... I know I can do this in the deriving class, but is there a way to do this in the interface itself?
A very ...
1
vote
0
answers
29
views
In TypeScript, only setters are overridden in subclasses, making it impossible to inherit getters from the parent class [duplicate]
The sample code is simple, as follows:
class Node {
id?: string;
private _parent?: Node;
get parent(): Node | undefined {
return this._parent;
}
set parent(value: Node | ...
5
votes
1
answer
2k
views
Flutter Freezed 3.0.0 with riverpod
I recently upgraded my Freezed from 2.x.x to 3.x.x. After the upgrade, my Riverpod state file gave me an error, indicating that I need concrete getters. I couldn't find any information, as it has only ...
2
votes
0
answers
46
views
How to Get the PDF attachments from Gmail JavaScript
`async fetch_pdf_attachment(from_email, to_address, subject, body, downloadPath = "./Data/Files/") {
let count = 0;
let email = null;
// Get access token
const accessToken = await ...
1
vote
1
answer
92
views
Does Volatile.Read() still apply if it is nested in a getter?
Consider this code in C#:
private int _backingField;
public int SomeNumber => Volatile.Read(ref _backingField);
public void Test_1()
{
var someNumber = Volatile.Read(ref _backingField);
/...
-3
votes
1
answer
68
views
Dynamically created Python properties not invoking getters and getters
My code dynamically generates properties and the classes to contain them. The code creates immutably-typed properties such that assignments to them are automatically converted to the correct type, ...
-1
votes
1
answer
56
views
Java difference between using getter() and getter(Object c)
public class Card {
private String cardRankString;
private String cardColorString;
private int copiesOfCard;
public Card(String rank, String color, int copies) {
...
0
votes
2
answers
110
views
How to Solve Law of Demeter Violation in Java Records?
I am using the below record in my Quarkus application and at some point I need to access the requestId field, located in Statements nested record. I want to avoid using the getters provided by the ...
-3
votes
2
answers
190
views
How to make C++ container class store pointer to a const, but get as a non-const?
I have the some code similar to the following. This is obviously a stripped-down version.
struct Foo {
int bar;
Foo() : bar(0) {}
};
class Container {
Foo* foo;
public:
...
0
votes
1
answer
39
views
Why direct access of data fetched from db using doctrine does not work while using getter do work?
In PHP Symfony project with doctrine, I am using following class with self-referencing attribute "credit" and another attribute referencing class foo as follow.
/**
* Bill
*
* @ORM\Table(...
1
vote
2
answers
114
views
How to write a getter which accesses a heap-allocated member variable
Lets say I have the member:
char* name;
When writing a getter function to this member, is this the correct way:
char* getName(){
return name;
}
But when we do this, now user of this class can ...
0
votes
0
answers
279
views
How to use Classes and their getters in Pinia store?
I have defined a Pinia store in which my user's character is made, stored/retrieved from localStorage, and pushed into an array which the store eventually returns.
This is done by defining the class ...
0
votes
3
answers
896
views
What is the difference between get and function in an Object (Javascript)?
I have hard time understanding why there are two different ways to perform an absolutely identical operation in JavaScript objects.
Here I've got an object which contains an array in its "log&...
0
votes
1
answer
118
views
Getters for multidimensional arrays
I was wondering how to exactly do a getter for a multidimensional array. I have a class (called Figure), one of its attributes is a bidimenisonal array (matrix), and I want to read that matrix from ...
2
votes
2
answers
756
views
Does FilamentPHP execute Models accessors when editing or viewing a row?
I have a critical concern, which might have a dumb & simple solution I cannot find, or it might open a Pandora box.
If you define an accessor in a model, and then you try to use it in a ...
0
votes
0
answers
45
views
javascript export variable or getter but returning value?
So I'm working with some export in js and do not understand the way they interact...
I have those two files :
imported file
export var a = 0;
// getter on a
export function A() {
return a;
}
// ...
-1
votes
3
answers
157
views
Getter returns undefined in if statement. Seems not working for comparisons
I have a ClockObj which has an AlarmObj in a "HAS A" OOP relationship. Or should I say injected through the constructor.
Inside the AlarmObj I have a isAlarmOn boolean variable. I am ...
0
votes
1
answer
50
views
why am I getting an error on calling clothing.getLastWornDate() method? [closed]
I am working on a Java assignment for school. In this method, I am trying to save to a file as described by assignment, but I am getting an error when calling clothing.getLastWornDate() and am lost as ...
0
votes
0
answers
96
views
Angular async pipe loading page forever when using getter in component
I have created standalone component.
import { AsyncPipe, CommonModule } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { FormsModule } from '@angular/forms';
@...
0
votes
1
answer
335
views
LWC setter is not getting called
LWC setter is not getting called.
<template>
{message}<br><br>1. getter value: {displayMessage}<br><br>2. setter value: {updatedMessage}
</template>
import { ...
0
votes
2
answers
553
views
Get the default value of a property of an abstract class
Is there a way in C# to access the default value of a non-static, non-const property that is defined in an abstract class?
For example, given:
public abstract class SomeClass
{
public int ...
0
votes
1
answer
179
views
How to subclass Array in JavaScript and override 'length' getter and setter?
I am trying to subclass JavaScript array and override 'length' getter and setter. This code is not working - it outputs nothing to the console because getter and setter are not called. How to fix this?...
-2
votes
1
answer
109
views
getter method does wait for a previous async call to complete
I have this in my JS file :
let xe = 0;
const get_usd2inr = async () =>
{
return await fetch(BASE_URL + "api/usd")
.then(response => response.json())
.then(response =>
...
0
votes
1
answer
58
views
How to dynamically set a getter for an Objective-C object property?
FooClass has a property called foo.
It's declared as @property (nullable, nonatomic, readonly, strong) id foo and it has NO underlying storage, it's not synthesized. It's just a getter that by default ...
1
vote
0
answers
80
views
Is it possible to assign return value for getter without private backing field C# [duplicate]
I come across the following example:
public class TimeService
{
public TimeService()
{
Time = DateTime.Now.ToLongTimeString();
}
public string Time { get; }
}
We have ...
0
votes
2
answers
41
views
Quizzler getter requires positional argument
I am doing "The Complete Flutter Development Bootcamp with Dart", and when I am getting the error below:
lib/main.dart:47:42: Error: Too few positional arguments: 1 required, 0 given.
...
0
votes
0
answers
53
views
I'm having trouble using a getter method for an object that has been initialized, but is not in the same class as the getter method
I'm writing a text based game for my computer science class (I'm a beginner and still learning new stuff pretty much everyday) and I'm trying to make a method that will print out the information of ...
1
vote
1
answer
536
views
Pinia getter undefined if used with filter
I have a Pinia store:
import { defineStore } from "pinia";
import { api } from "@/services/api";
export const useMaterialStore = defineStore("material", {
state: () =&...
0
votes
0
answers
52
views
python getter and setter properties
I am new to properties in Python and a bit confused on how below code is working
class FavoriteShape:
def __init__(self, color, shape):
self.color = color
self.shape = shape
@...
0
votes
1
answer
135
views
DWScript: Property getter/setter for object
The tdwsUnit declares a property of type TObject, as well as a getter and a setter. An instantiated object shall be stored in an "object store" on the Delphi side. The goal is to transport ...
0
votes
1
answer
431
views
How to importing library that define "favorites" at Flutter
i am very beginner ..and just start learning flutter. I follow "Your First Flutter App" from Google Codelabs, and stop at this step: https://codelabs.developers.google.com/codelabs/flutter-...
0
votes
1
answer
89
views
Const-correctness with getters of vector of non-pointers [duplicate]
I have a quick question regarding const-correctness for getters of vector of non-pointers.
Basically, I have this class with a non-const getter and a const getter for m_Vertices:
class Mesh
{
public:
...
0
votes
0
answers
62
views
IntelliJ seems to not recognize my getter methods
I'm trying to display data from a database in a TableView in JavaFx, and I'm using the class CheckAssunzione for creating my assunzione object that will be used to populate the table. I also have a ...
0
votes
1
answer
35
views
Vuex (Vue3) unable to transmit payload
I have removed the methods that are not involved in the case for a more concise display.
Need to return the count value for the object with the specified id. When I pass a valid id to counter, the ...
3
votes
2
answers
186
views
ValueType as property in class
I am a bit confused with a concept of value types as properties in a class.
As far as I understand, when getter is called - a copy of value type is returned.
Let's have an example:
public struct Point
...
0
votes
2
answers
255
views
How to compute a getter in vue?
I'm expecting to display a computed getter property, but VSC gives me the error "Expected to return a value in 'features' computed property." Even though I'm returnng a true value in getter ...
0
votes
1
answer
21
views
What is the "type" of an ES6 class getter in Typescript?
I have a class that looks like this:
export class WidgetsManager {
private foo?: boolean;
private bar?: boolean;
// ... and so on
constructor(config: Config | null) {
this.foo = config....
2
votes
2
answers
7k
views
The getter 'params' isn't defined for the type "GoRouterState" Flutter
I am trying to resolve the issue with getter, error message:
The getter 'params' isn't defined for the type 'GoRouterState'.
Try importing the library that defines 'params', correcting the name to ...
0
votes
0
answers
142
views
Why does the entity's getter get called twice?
I use Spring Boot with Hibernate. I have an entity containing some credentials:
@Entity
class MyEntity {
@Column(name = "credentials", columnDefinition = "jsonb")
@Type(...
1
vote
1
answer
337
views
Ember Octane, Tracked property not recomputing get function using the property
In emberJS Octane, I expect a "get" function to be recomputed when the used tracked properties inside of it changes. It does not in my case.
Here is my template :
{{#each this.model....
0
votes
1
answer
70
views
How to pass an input event to the getter store Vuex?
How to pass an input field to the getter?
I'm trying to pass th einput field to the getter as a paramether. How to pass the param to the getter ?
<input
type="text"
...
-1
votes
1
answer
275
views
Converting a Javascript Object to Lua table
I have a Javascript object where one of the keys is a getter and I want to convert the entire object to a Lua table in order to use it in a wiki module.
So far I have managed to find how to convert ...
0
votes
1
answer
172
views
How can I pass back a function/method variable?
If I want to create a getter accessor for a method variable, the getter does not give back the variable, but it executes the code referenced by the variable.
unit Unit5;
interface
uses
Winapi....
1
vote
1
answer
100
views
What is the difference between a function and getter in Dart?
To get a value from a function I can to this:
bool goOutside() {
if(today is a good day){
return true;
}else{
return false;
}
}
But I can also do this:
bool get goOutside {
...
1
vote
0
answers
33
views
Python property getters and setters not working [duplicate]
I am attempting to use property-based getters and setters in Python and am getting strange problems. Consider the following code:#!/usr/bin/env python
class anyThing(object):
def __init__(self):
...
2
votes
1
answer
661
views
Config.GetSection<T> with invalid class property names
Using IConfigurationRoot extension method
public static T GetSectionAsObject<T>(this IConfigurationRoot configuration, string key)
{
return configuration.GetSection(key).Get<T>();
}
I ...
-1
votes
2
answers
94
views
Why doesn't return getter like in Java (C#)
I want to move from Java to C# and I want to try getter and setter like in Java
internal class Person
{
internal string name;
internal void setName (string name)
...
-2
votes
1
answer
42
views
How to access text value outside of initialization of Radiobutton
fruit_frame = LabelFrame(root, text = "Fruit", padx = 15, pady = 15) fruit_frame.grid(row = 0, column = 0)
veg_frame = LabelFrame(root, text = "Vegetables", padx = 15, pady = 15) ...
0
votes
0
answers
65
views
Getter returning incorrect value
I'm building an application for storing/searching/sorting cars and I'm running into an issue with one method.
I have six ArrayLists, storing variables of different data types:
Car c1 = new Car(1, &...
0
votes
1
answer
181
views
Swift Crash in getter for location services
I received several crashes in Xcode organizer, but I'm not able to find the root cause for it. Would be nice, if someone could look at it and give his thoughts ...
... here is the code of the getter
/...