Questions tagged [dart]

Dart stands out as an impeccable programming language, emphasizing on class-based structure and static typing to develop remarkable web and mobile applications. It seamlessly compiles into cutting-edge JavaScript, enabling smooth execution in browsers, while effortlessly compiling into native code for superior performance on Android and iOS mobile platforms. Additionally, Dart exhibits its versatility by equally excelling on the command-line for scripting purposes and server-side application development.

What is the best way to send nested model objects to the parent widget in Flutter?

While attempting to populate my different models with values, I encountered an issue when using the toJson() function of the parent model. This function is supposed to call other models with their objects and create a JSON format that can be sent to Fireba ...

AngularDart's runtimeType object

My component is designed to accept a model object, but the type of this object determines which specific component will be rendered inside: <div [ngSwitch]="poolModel.runtimeType.toString()"> <template ngSwitchCase="CryptonoteMiningPool">& ...

The class `MappedListIterable<dynamic, dynamic>` cannot be assigned to the type `List<Weather>`

I have created three classes to handle JSON parsing from an API call. Here are the classes: class CurrentWeatherInfo { double temperature; double feelsLike; double minTemperature; double maxTemperature; int pressure; int humidity; CurrentWea ...

Easily create clickable words in Flutter by extracting specific words from a JSON String

In my JSON response, I receive a set of questions. My goal is to split these questions into words and compare them with another JSON response. When there's a match, I want to highlight the matching words and make them clickable to display a pop-up showing ...

What is the best way to eliminate excess space within a TextFormField in Flutter?

When I added the suffixIcon, a slight extra space between the hint text and underline became noticeable. However, when the suffixIcon was not included, the layout looked perfect. In the examples of "New Password" and "Confirm Password," the issue with the ...

I'm looking to create a redirect feature using a QR code that will direct users to a specific page within my Flutter app. How

When the user scans the QR code, they will be taken to a secret internal page that can only be accessed through this specific link. I attempted to use various libraries such as , but it did not achieve the desired outcome. ...

Error occurred while retrieving JSON data due to utilizing null check operator on a null value

I'm having trouble understanding this code. builder: (context, snapshot) { if (snapshot.data != null && widget.stored!.b) { return new GridView.count( children: List.generate(snapshot.data!.length, (index) { return ...

A collection of text elements within an API request,

Correct Answer below. I need help with selecting products in bulk rather than individual calls. I've tried multiple syntax combinations but keep receiving 404 or 405 errors. I'm trying to compile a list of product codes, but the error codes persist. Ins ...

What is the process of transforming a list of arrays, which is in JSON format, into Dart?

Having trouble with the JSON_ANNOTATION feature when dealing with a json that contains nested arrays. Uncertain about how to convert the paths in the array into a single Paths object. Maybe something like this, but it doesn't seem to handle multiple level ...

Converting a lengthy string of coordinates into latitude and longitude in Flutter

From a Json API call, I am receiving a group of latitude and longitude coordinates formatted as a long string in the "lineStrings" block. Typically, I would expect individual latitudes and longitudes that I could iterate through, but instead, I have this ...

Utilizing dynamic JSON values in Flutter for efficient parsing

Within my Flutter application, I am receiving a JSON response and able to parse it with ease. However, there is a key named "data" in the JSON response that provides me with dynamic values as follows: Sometimes it appears like this (1): "da ...

Public external requirement

Is there a proper way to utilize external dependencies with pub? Specifically, I am interested in incorporating Materialize-css and utilizing it in my scss file. When installing it via npm, pub seems unable to locate it in the node_modules folder. Placing ...

Utilizing a FutureBuilder for fetching JSON data in a Flutter DropDownButton

I have been developing an app using Flutter and I am currently working on implementing a Dropdown Button that will display values received from a JSON response via an API built with Django. Here is the JSON response: [{"name": "FC1", "username": "admin"} ...

In an attempt to transform a List<T> into a JsonString for storage in sharedPreferences, there arises the challenge of dealing with a data structure that includes both a Contact object and a boolean value within &

Struggling with saving a list to sharedpreferences by converting it to JsonString. Facing the issue of 'encodable object failed: Instance of 'CustonContact''. Looking for assistance. class CustomContact extends Contact{ Contact contact; b ...

Linked to various listviews, numerous flat buttons can be found. But how can we make the unselected buttons appear greyed out and unfocused

I am currently working on an app design that includes 3 flat buttons placed in a row. The first button is selected by default and displays a listView widget. The other two buttons should be greyed out until clicked, at which point they will show another ...

Dealing with dynamic JSON in Flutter: A concise guide

{ "status": "error", "msg": "Please ensure all fields are filled out properly", "error": { "device_token": [ "The device token field is ...

Error encountered while establishing connection with Flutter, Node.js, and Socket.io

I'm in the process of building a multiplayer TicTacToe game using Flutter and Node.js with Socket.io integration. Here is the code: Flutter late io.Socket socket; final String url = 'http://localhost:5000'; @override void initState() { super ...

Tips for fetching data from a Django REST API endpoint and displaying it in a Flutter Dropdown widget

I am currently working on a project that involves using Django REST for the backend with Flutter dropdown widget to display a list of Country states. However, I am facing challenges in getting the list of states to appear in the dropdown menu. Can anyone p ...

Each sub-array must be assigned a unique parent array name in the JSON structure

Flutter / Dart Discussion I have an array with an "Accessories" list that includes a brand name ("samsung"). I need to add the brand name to all subarrays. In the subarray of the "Brand" key, you can see the second code space which contains the parent ke ...

Cracking the Code: Unleashing the Art of Parsing JSON with Dart's Dynamic Object

Can anyone help me with mapping this JSON in Dart? I received this JSON as the response.data from a get request made using the Dio library in Flutter. [ { "getPlayersFilterResult": { "Players": [{p1},{p2},..] } }, ...

Navigate through the pages by simply clicking a button on my navigation bar

I currently have a NavigationBar on my app that consists of 3 tabs. I am looking for a way to switch the active tab or destination when a button is pressed. The Navigation Bar setup in the Home class: body:IndexedStack( index: currentPageIndex, ...

Require a standardized query parameter format within the URL

In my flutter app, I have a method that performs a get request by passing parameters into the URL. Future<Map<String, dynamic>> getData( {String path, String token, Map<String, String> params}) async { try { Uri uri = Uri ...

Ways to ensure your drawer remains constantly open

I'm interested in incorporating a drawer similar to the one shown in this image into my Flutter app: View Image Currently, I am using NavigationRail and have read that it is possible to add a menu button to open a navigation drawer. Can anyone provid ...

Json model lacks a getter for instances in the class

I'm facing a problem that I couldn't find the solution to through Google or here, so here's my issue. I'm trying to retrieve JSON data from my own JSON test server at: The JSON data is nested and I'm attempting to GET the "r ...

Tips for unraveling intricate JSON data structures in Dart/Flutter

Following my server request, I received the following JSON data: [ { "id": 56012, "name": "The name", "description": "<p>description</p>\n", "regula ...

Tips for processing JSON data in a Flutter application when the response consists of an array of objects

I received an API response structured like this: [ {"name":"lakshay","id":"1217","type":"Staff","temperature":56.6,"date":"12-06-2020"}, {"name":"lakshay","id":"1217","type":"Staff","temperature":56.6,"date":"12-06-2020"}, ..... ] I want to ...

Experiencing problem when using Angular Dart material-input with data type set to number

I am currently in the process of constructing a web application (essentially an e-commerce platform) using Angular Dart and incorporating elements from materialDirectives to create the app's components. My primary focus at the moment is on developing ...

Is there a hashing algorithm that produces identical results in both Dart and TypeScript?

I am looking to create a unique identifier for my chat application. (Chat between my Flutter app and Angular web) Below is the code snippet written in Dart... String peerId = widget.peerid; //string ID value String currentUserId = widget.currentId ...

Using DART language to read a JSON file stored locally on the client side, eliminating the need for a server

Having some trouble reading data from a JSON file with the following code: void fetchData(Event e){ var path='json/data.json'; var request= new HttpRequest(); request ..open('GET', path) ..onLoadEnd.liste ...

Creating a customized background color for an Elevated Button styling

I'm currently working on customizing a Flutter ElevatedButton within the context of an app that adheres to a specific color scheme created by myself. Is there a way to apply styles to this button using a particular hexadecimal color value (for example, u ...

Exploring nested grandchildren components in Angular2 Dart

Currently, I am attempting to make the following code work in Angular2 Dart: <div class='test'> <accordion2> <accordion-item-2 title="blah" active="true"> <sample-form-1></sample-form-1> ...

Assertion failure at line 4429, position 12: The condition '!_debugLocked' is not satisfied

Below is the code I have created for a ListView.builder to display 4 elevated buttons in a container with axis.horizontal. When clicking on the container, it should navigate to another page. Additionally, I have set up a list to retrieve data from each c ...

Tips for presenting Nested JSON information?

I am having trouble figuring out the correct syntax to display DietName from Data{}, PartnerName from PartnerData[], and DayName from DayList[]. These data are inside another ArrayList, and I need help displaying them. { "Status": "1", "Message": " ...

Angular 2 now has the ability to detect keydown events triggered from any part of the page

Is there a way to enable keyboard control for a view? I attempted using document.keydown, but it wasn't successful. How can I make the document accept keyboard input? A solution that worked for me was implementing this in my component class: @HostListene ...

Retrieving JSON data in Flutter based on category

I am in the process of creating an e-commerce application. I am using a ListView.builder to show the data but I'm struggling with fetching products based on the selected category. Below is the model for the list of categories: class Category { final ...

The correct way to handle JSON parsing in the background using Flutter

Currently, I am venturing into the world of Flutter and facing challenges with JSON parsing. Initially, I followed the recipe for data fetching which worked smoothly with my custom JSON. However, when I transitioned to background parsing (which is more be ...

Obtaining Local JSON data in a standard Flutter class

In the Services-> math_logic.dart file, I have a page dedicated to mathematical calculations where I did not use StateFul Widget. However, I encountered an error indicating that 'Future is not a subtype of String'. It seems that there was also an issue ...

Exploring Child Elements in Angular 2 Templates

I am working on a component and I need to access some child nodes from the template. I was able to access the details div, but I'm not sure why the code is functioning as it does. Can someone please explain what the Future class does? Also, why is the fi ...

Showing all columns in a table using Flutter

I'm currently developing a test application using Dart, which is designed to display and insert data into a database hosted on 000webhost.com. In my app, I'm trying to display JSON data in a table where all the columns are contained within a sin ...

Tips on how to effectively sort JSON data within the itemBuilder function

I am facing an issue with filtering JSON data that contains objects with name, latitude, and longitude. I only want to display the names of objects that have both latitude and longitude values. Example object in JSON with lat and lng: dynamicDataUrl: ...