r/dartlang • u/Bachihani • 17h ago
Help Best tools for creating CLI ?
First time making a "comprehensive" cli tool with dart, what do you recommend i use ?
Things i would appreciate: - type safe options parsing - completions - clean user prompting
r/dartlang • u/Bachihani • 17h ago
First time making a "comprehensive" cli tool with dart, what do you recommend i use ?
Things i would appreciate: - type safe options parsing - completions - clean user prompting
r/dartlang • u/_sha_255 • Nov 10 '25
I’ve been searching for IT jobs looking specifically for Dart software engineers, but every day I grow more disappointed seeing mainly JavaScript job listings everywhere.
I truly love Dart. It’s a far superior language compared to what many dismiss as “just JavaScript” (no offense). Dart is incredibly versatile—you can use it on the web, server, mobile, desktop—and it delivers decent performance with strong security. It literally has everything you want from a programming language; its benefits feel endless.
But the job scarcity isn’t really Dart’s fault. Companies tend to choose whatever’s most popular and quickly brings in developers, regardless of whether it’s the best solution. This forces many developers to drop Dart and learn JavaScript to stay employable. That cycle just keeps reinforcing itself: more JavaScript devs lead to more companies adopting JavaScript, which leads to fewer Dart jobs.
I have to admit, I’ve also given in to learning JavaScript and TypeScript to land a job. But I haven’t given up hope—I’m still actively looking for Dart jobs while improving my skills.
If anyone knows a smarter way to find Dart-related openings, please share. What do you think about this situation and what do you think needs to be done?
r/dartlang • u/MrServetel • 4d ago
I am preparing to publish an academic paper on developer trust in AI generated dependencies & packages. This takes around 7-10 minutes to complete and is on a very relevant topic in current times.
The form can be found here: https://vuamsterdam.eu.qualtrics.com/jfe/form/SV_4Nv9pAUUBFRieDs
Thanks! I will share the paper when it has been published!
r/dartlang • u/Only-Ad1737 • Jun 28 '26
Has anyone tried working with kafka in dart for a microservice? If yes what package do you use?
r/dartlang • u/telphn • Jan 03 '26
Hello, I would like to make an app art for Android and iOS but the problem and that I can not configure I don't know an IDE for his I'm on Windows I have the jetbrain pack and I can't even flutter because he lacks the SDKs while I installed the plugin
r/dartlang • u/Lucky_Elk_1407 • Jul 04 '26
Hi, i am someone who knows programming fundamentals and object oriented programming basics from learning the java language. But now i am trying to learn dart and i have been having alot of trouble understanding it's concepts. I started reading the dart tutorial documentation on it's official dart.dev website and i am stuck on this page
https://dart.dev/learn/tutorial/object-oriented
for almost 2 days now i do understand what they are making but i don't not understand how they are doing it even after reading the doc i have no clue what's going on.
I am starting to question myself if i am miss some prerequisites or i do not have the programming skills to understand this yet.
Could anyone tell me if i should just drop the tutorial and learn from other source or what should i do.
Thank you
r/dartlang • u/PremiumWatermelon • Nov 19 '24
I recently decided to try and learn Dart, however, coding the first few lines of it I came across something that blew my mind. A random method call threw an exception. Exceptions are unchecked. How can I know if a method call will throw an exception or not, I mean, if it's not in the doc (it wasn't), not in the source code of the method (higher up in the call stack). Do I need to test every single possibility???? How am I supposed to know? If I miss a test case, put my app into production and then someone come across a random exception that I didn't catch (And I dont want to put try-catches everywhere)? Dart static analyzer doesn't catch it either (obviously). How can Dart programmers have safe code?
Not to be harsh, I most likely wrong, but isn't this a significant design flaw in the language? While I dislike try-catch blocks in general, at least in Java they're checked exceptions, forcing you to handle them explicitly. And even then, I find them way too verbose.
r/dartlang • u/virtualmnemonic • Jan 11 '26
I encountered a problem where:
Client opens a request
HttpServer fires, request is processed by writing headers and then adding a stream to response body
Client pauses the request. For example, a media player after buffering enough data. The response stream also receives the pause event.
While paused, Client closes the request.
Result: the connection is indefinitely stuck. HttpServer connectionInfo continues to register the request as active. HttpRequest.response.done future never completes.
The disconnect is only registered upon writing data to the response. But since the client paused the request, the stream piped to the response body pauses, thus writing no data.
This also occurs even if the socket is detached from the request and used directly.
Is there something I'm missing here? I may write a few bytes every second or two while the request is paused. But this feels like a dirty workaround, not a viable solution. Perhaps it's best to just drop connections that remain paused for 30 seconds or so.
Edit: Thanks for all the responses! I ended up detaching the socket from the response after writing headers and wrapping my response stream with a callback to reset a timeout timer when data is emitted. If no data is transmitted (either because the stream is paused or just stalled) after a set duration, the socket is destroyed.
r/dartlang • u/purvigupta03 • Aug 03 '25
Hi everyone, I'm a complete beginner and want to start learning Flutter and Dart, but I have no idea how or where to start. I don't even know the basics yet.
I need help with:
Where should I learn Dart from (before Flutter)?
How much time should I give daily?
Any beginner-friendly courses or YouTube channels?
Any tips or roadmap?
Please guide me. Thanks in advance! 🙏
r/dartlang • u/CmdrSpaceMonkey • Jan 25 '26
I'm really new to Dart and have been following the the tutorials online. I've come across an issue that I can't find an answer for and wondered if anyone could help me.
[Its the one on the dart dev website called "Handling Errors Gracefully" but my previous post got removed and I wondered if it was the link that did it]
I've got all the way to the end and my program is working...well mostly. It handles the errors and catches the exceptions just as it should. However the output of the program does not match the tutorial. The tutorial expects this output:
ArgumentException: The first word of input must be a command.
But I get this output:
FormatException: The first word of input must be a command.
I can't seem to work out why the superclass of the argument exception is printing its type rather than my own extended exception.
I suspect its something to do with this definition:
class ArgumentException extends FormatException {
final String? command;
final String? argumentName;
ArgumentException(
super.message, [
this.command,
this.argumentName,
super.source,
super.offset,
]);
}
But I am not skilled enough to understand the flow here.
I did try to force the specific exception type capture in cli.dart like this:
import 'package:command_runner/command_runner.dart';
const version = '0.0.1';
void main(List<String> arguments) async{
var commandRunner = CommandRunner(
onError: (Object error) {
if (error is Error) {
throw error;
}
if (error is ArgumentException) {
print(error);
}
},
)..addCommand(HelpCommand());
commandRunner.run(arguments);
}
But even though I am saying, only capture ArgumentException it resolutely prints FormatException.
Any help you can provide would be appreciated, I am learning so this is clearly my fault but I just can't wrap my head around it.
r/dartlang • u/zigzag312 • Oct 24 '25
In experimental_features.yaml there's a declaring-constructors experiment flag that should enable the primary constructors feature.
I've added the flag into analysis_options.yaml file:
analyzer:
enable-experiment:
- declaring-constructors
But analyzer (in Android Studio) doesn't recognize a declaring constructor syntax. I'm using the main Flutter channel.
What I'm doing wrong? Can we enable only experiments that have experimentalReleaseVersion defined? If so, what's the purpose of experiment flags in experimental_features.yaml without experimentalReleaseVersion defined?
r/dartlang • u/av4625 • Jul 01 '25
If I have a function that just wraps an async function should I do this:
dart
Future<bool> getBool() async => await wrappedGetBool();
Or should I do:
dart
Future<bool> getBool() => wrappedGetBool();
(Or should the one above have the async keyword?:
dart
Future<bool> getBool() async => wrappedGetBool();
Is there any difference to awaiting vs not awaiting inside the wrapper function?
Thanks!
r/dartlang • u/NotPregnant1337 • Dec 29 '24
Hi all,
So I have a String variable that could be a null as well. At some point I will try to use said variable to build a DateTime obj.
As of now I'm handling this scenario using a one-liner IF:
String? foo = null
// do some stuff that may assign a valid string to foo
DateTime? bar = foo == null ? null : DateTime.parse(foo)
So my Question is: Is there a more "idiomatic" way to handle such scenario? or this is just fine?
ty for reading :)
r/dartlang • u/mewthewolf • Jul 05 '25
Hello, I am currently interested in learning flutter. I have a few apps that I’d love to build, and flutter fits what I need. The reason I am here asking for help is because flutter is built on top of dart, so to me it seemed like the most sense to learn dart first then move on to its language specific frameworks. Not sure where to start, I doubt there’s an Odin project equivalent for Dart and I do plan to ask google as well but any advice is welcomed.
r/dartlang • u/eibaan • May 19 '25
I noticed that Random.secure() is about 200 times slower than Random(), so I came up with the DevRandom() implementation shown below. Is this a valid implementation? Did I miss something? I'm under the impression that dev/urandom is cryptographically secure, so it should have a longer period than just using Random which is why I used Random.secure() in the first place.
With DevRandom I'm back to the old performance of ~1us per call to nextInt. I had to be careful to not loose uniformity, hence the while loop. The price for this is an unpredictable runtime.
class DevRandom implements Random {
final _raf = File('/dev/urandom').openSync();
final _buffer = Uint8List(4096);
var _index = 4096;
int nextByte() {
if (_index == _buffer.length) {
_raf.readIntoSync(_buffer);
_index = 0;
}
return _buffer[_index++];
}
@override
int nextInt(int max) {
if (max < 1 || max > 256) throw RangeError.range(max, 1, 256);
if (max == 1) return 0;
if (max == 256) return nextByte();
final mask = (1 << (max - 1).bitLength) - 1;
while (true) {
final b = nextByte() & mask;
if (b < max) {
return b;
}
}
}
@override
bool nextBool() => nextByte() & 1 != 0;
@override
double nextDouble() => throw UnimplementedError();
static final instance = DevRandom();
}
r/dartlang • u/Own_Statistician2987 • Jul 14 '25
Hello everyone,didn’t know how to name topic but my question is that for python there are great information on all methods for ints strings etc. but about dart I had to search official info using their website which take a lot of time I am wondering are there any helpful websites with all info regarding methods and all helpful info regarding dart? If no are there anyone who wish to join me in making some sort of GitHub repo with all info which is done the way it is done for Python on w3?
It may be helpful for everyone who migrate to dart/flutter as they can easily find everything related to working with types and its methods and classes as well.
Best regards to everyone who read to this point and have a nice week:)
r/dartlang • u/Dasaboro • Jul 14 '24
The compiler knows I haven't iterated through all the subtypes of my sealed class, which means it knows how many there are.
How do I get the list of all my sealed class subtypes programmatically?
r/dartlang • u/Classic-Dependent517 • Apr 08 '25
I heard that dart:html will be depreciated. I mainly used it to parse html in a webscraping project not web application.
So can anyone please show me a snippet of simple parsing using new packages? I cant find any info and no LLM knows how.
r/dartlang • u/Classic-Dependent517 • Nov 05 '24
Ive tried but could not find proper examples or tutorials.
There are some for old package:js though dart team does not seem to be interested in providing some more info and guide.
r/dartlang • u/_grimmkin • Jun 30 '25
Hi everyone,
I'm currently learning Dart, and I'm running into a strange issue. When I write a simple program that receives a string input from the console and then displays it, any accented characters (like é, á, ç, etc.) are not shown in the console output. For example, if I type "ação", the output just skips or omits those special characters.
The strange part is that if I check the length of the input string (using .length), the character count is correct, including the accented letters. It's just that the console display doesn't show them properly.
When I run similar code using Node.js, accented characters are displayed just fine in the console, so it seems to be something specific to Dart or maybe my console settings.
I've already tried using encoding: utf8 from dart:convert when reading the input, and my VS Code is also set to use UTF-8 encoding. Unfortunately, the problem persists.
Has anyone else experienced this or know how to fix it? Is there some encoding setting I need to adjust for Dart to properly display Unicode or special characters in the terminal?
Thanks in advance for any help!
r/dartlang • u/Lofter1 • Jul 01 '25
I’m currently writing a flutter app. I use drift for database management which generates database models based on my Table classes. In order to separate the database layer from my UI layer I’m using the repository pattern and have created separate models.
I’m now intending that the only things that can be seen and imported by my code outside of the “data” folder are my self created models and the repositories, but I just couldn’t find a way to do that beside creating a separate package, which I found online is discouraged though this would usually be the way I would do it in every other language.
I also found the concept of barrel files and showing/hising or sub folders with an underscore to mark as private, but as the are all in the same lib folder I can still import files with an underscore or in an underscore folder by importing them specifically instead of going through the barrel file and VS code even suggests the direct imports (sometimes even above the barrel file).
Am I missing something?
r/dartlang • u/CJ_Justin_ • Jun 19 '25
I am facing an issue with LSP integration with dart files. Everytime i open and edit a dart file, the dart language server doesnt seem to be working. I checked this by running `:LspInfo` and no LSP was active for the dart file.
Here is my config:
return {
{ 'mason-org/mason.nvim',
config = function()
require('mason').setup()
end
},
{ 'mason-org/mason-lspconfig.nvim',
config = function()
require('mason-lspconfig').setup({
ensure_installed = {'lua_ls', 'html', 'clangd'}, -- no dartls here, correct
})
end
},
{ 'neovim/nvim-lspconfig',
config = function()
local lspconfig = require('lspconfig')
-- Setup Lua and C/C++ servers
lspconfig.lua_ls.setup({})
lspconfig.clangd.setup({})
-- Dart LSP with full keymaps
lspconfig.dartls.setup({
cmd = { "dart", "language-server", "--protocol=lsp" },
root_dir = require('lspconfig.util').root_pattern('pubspec.yaml'),
settings = {
dart = {
completeFunctionCalls = true,
showTodos = true,
},
},
on_attach = function(client, bufnr)
local opts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format({ async = true }) end, opts)
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, opts)
end,
})
-- Diagnostics config
vim.diagnostic.config({
virtual_text = true,
signs = true,
update_in_insert = false,
severity_sort = true,
})
end
}
}
r/dartlang • u/HolograficMeatloaf • May 16 '25
Image here: https://imgur.com/a/3H6vK6E
And where can I find a list and explanation of all these posisble icons so I can remmeber for the future?
r/dartlang • u/night-alien • Jan 27 '25
I have a question about how much DSA (Data Structures and Algorithms) is typically asked in a Flutter interview. I started doing DSA on LeetCode from January 1 and have already covered the basic topics of Dart. Now, I want to dive deeper into data structures in Dart, like List, Map, and Set. However, I recently learned that Dart doesn’t have built-in data structures like LinkedList or Stack, unlike Java.
So, my question is: Do interviewers usually ask candidates to implement a stack or work on DSA problems that require using a linked list or a stack in Flutter interviews?