Questions tagged [dart]

Dart is a class-based, optionally-typed programming language for building web and command-line applications. Dart compiles to modern JavaScript to run on the client and runs natively on the Dart VM for server-side apps.

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

N Queens Puzzle in Dart

I have already written two solutions to the N Queens Puzzle problem, so I might as well write another one. This one is in Dart: ...
FlatAssembler's user avatar
2 votes
0 answers
161 views

Flutter Cubit: 2 Screens and Listview

I try to program a small app to track my cost spendings. As state management I use Cubit. As I am a flutter beginner, I wanted to verify if I implemented it correctly. The UI consists of 2 screens: 1 ...
Rasputin221's user avatar
1 vote
1 answer
154 views

Dart Non-Reentrant Async Lock

This class synchronizes access to an async resource. If retainFutureErrors is false, it will keep retrying until there is a success. Otherwise, the ...
Christian Findlay's user avatar
2 votes
0 answers
39 views

Library for managing flutter rebuilds based on state changes

This is my new library for managing flutter rebuilds based on state changes. It is very similar to AnimatedBuilder but takes a factory to create the notifier instead of an instance of the notifier. It ...
Christian Findlay's user avatar
1 vote
1 answer
399 views

Am I writing Flutter code in the correct style? [closed]

I'm cleaning up my Flutter code and I'm not sure if I'm writing my Flutter code in the correct style. First, here's my code to import the file: ...
My Car's user avatar
  • 121
2 votes
1 answer
149 views

LeetCode#494 target sum (dart is slower than python)

I'm trying to solve a LeetCode problem target-sum, in two languages: Python & Dart. The difference of time taken is shocking for me" Python took ~70ms while Dart took ~900ms !! Why does Dart ...
Abhishek Patil's user avatar
2 votes
1 answer
357 views

Dart Ioc Container

This package is on pub dev here It's on Github here ...
Christian Findlay's user avatar
1 vote
1 answer
2k views

Authentication middleware using Dart Shelf

I'm using the shelf package from Dart to implement a backend for the realworld-example-app. According to the specs, some routes require authentication, some don't, and in others the authentication is ...
Marcus Vinícius Monteiro's user avatar
3 votes
3 answers
222 views

Remove else-if statement from multi-conditional logic

INTRODUCTION I am studying the book Five Lines of Code (2021) by Christian Clause. The book covers several techniques regarding refactoring legacy code. I am learning much and applying several of its ...
George Lee's user avatar
3 votes
1 answer
3k views

Adding multiple items to a list in flutter

I'm new to coding in general and I am working in flutter right now. I've successfully been able to add single string objects into a list but I'm having issues adding an object with multiple strings ...
Jared's user avatar
  • 31
1 vote
0 answers
23 views

Parse Back4App database as a master database change log rather than actual database- thoughts on this design principle?

first post here. I'm looking for some general input as to the correctness of what I'm trying to do here. Is this a good idea, bad idea, what could be plus points or negative aspects to this design? If ...
RobbB's user avatar
  • 111
-1 votes
2 answers
429 views

Should I add optional parameter to my function for test cases? [closed]

I have the function below, I want to access the context globally and I don't know if it's a good idea, I'm getting the context from the Application, I have TestAppliction in the test environment and I ...
ali-star's user avatar
  • 101
1 vote
1 answer
258 views

Flutter input widget with multiple options (monthly/annual/currency/percentage)

I currently have the following code to build this widget: ...
Jan's user avatar
  • 61
3 votes
1 answer
68 views

I have a input grid with more than 40 input-fields hardcoded

I am new to flutter and i managed to build a working Grid which does what i want it to do but the code is a duplicated hell and i didn't manage to create it dynamically while still keeping track of ...
Darjusch's user avatar
4 votes
1 answer
148 views

Search filter for words in dart

I need to add search filters for firebase So that I can get search result easily and precisely I was altering the code from hereThis Medium Post I would like to optimize this code. ...
Asbah Riyas's user avatar
2 votes
1 answer
66 views

Finding powers of (x+1)

It appears to me that this has been before in all languages except dart... Referenced in order btw, any improvements, any tips, any feed back would be appreciated... ...
Pranit Shah's user avatar
2 votes
0 answers
104 views

Building an app in Flutter [closed]

I am just starting to code by myself in Flutter. I've built this so far and here is the image. Can you show me what would be better or cleaner code? I used Row widget for it, but I guess I should ...
Jemomei's user avatar
  • 29
3 votes
0 answers
145 views

Flutter: ToggledButtons using FlatButton

I'm new to Dart and Flutter and I would like to know what do you think about this code and if it's any way that I could improve it :). ...
Vildnex's user avatar
  • 195
2 votes
0 answers
1k views

Flutter - Set the state of the dynamically created child widgets

This is what I wan't to do: In my app I've 2 custom widgets called SelectItems. If the user clicks on item, it changes the background color. Everything is working ...
Runtime Terror's user avatar
0 votes
2 answers
209 views

NoSQL data model design for players in a game

I am modelling a game which can be single (player1 vs player2) or double (pair 1 vs pair 2, where each pair contains 2 players) and each game has a score. The game is group and date based e.g. Group A ...
dragonfly02's user avatar
3 votes
0 answers
2k views

Custom permission Dialog in Dart

I'm using the flutter_simple_permissions plugin to request permission to read contacts on my flutter application. I want the app to quit when a user denies the permission, and need to show them a ...
Lambasoft's user avatar
  • 131
1 vote
1 answer
6k views

Flutter - Implementing a simple ListView with MVVM

I've implemented a simple ListView in MVVM that displays a few PrepSteps (short form of PreparationSteps). While implementing I wasn't sure about if my approach is "...
Jens's user avatar
  • 897
2 votes
2 answers
297 views

Regex to DFA parser in Dart

I've created a Regex to DFA parser, using Thompson's construction algorithm and epsilon-reduction. Here is the code: builtins.dart: ...
Qwerp-Derp's user avatar
2 votes
1 answer
56 views

Transform poor CSS into a more beatiful form in Dart

I have this script that opens a file containing (possibly) bad CSS, lexes the content of it and creates a new file with the same code in a more pleasant way to look at. It formats it and sorts the ...
OhMad's user avatar
  • 133
2 votes
2 answers
692 views

Performance of RegExp vs Rune Loop

I was recently talking to someone about a function I wrote to mimic (very basically) the string interpolation function String.Format() found in the C# language. ...
Hydra's user avatar
  • 21
7 votes
1 answer
1k views

Snake Game in Dart

First project in Dart - looking for style tips. I feel like I'm writing it a bit like Java, and would like to learn how to write dart-y dart. Also - what's the convention on multiple files in a ...
dysruption's user avatar
5 votes
2 answers
856 views

A Sudoku game made from Google's Dart language

This is my first real web project and I have never touched JavaScript (barely touched CSS), so I just skipped that and went to dart for fun. Here's a live demo The code for the dart file is down ...
c0rruptbytes's user avatar
2 votes
1 answer
135 views

Providing core functionality orthogonal to business logic in Dart

Below is a simple Trade class with minimal business logic: primarily a method to get market value associated with the trade. But the trade needs the following pieces of core functionality, orthogonal ...
user1338952's user avatar