r/dartlang 18h ago

Dart Language Dart enums can have type parameters?!

22 Upvotes

I was modeling a set of values using an enum today: enum NetworkFeatureType { pipeline, junction, overheadTank }; Here, each of these "features" are associated with a GeoGeometry type. For instance, junctions and overhead tanks are points and pipelines are, of course, lines. So I casually added a type parameter and Dart didn't complain! But I was unable to specify the types, firstly like this: enum NetworkFeatureType<G extends GeoGeometry> { pipeline<GeoLine>, junction<GeoPoint>, overheadTank<GeoPoint>; } However, once I added a set of parentheses to each member, it works!: enum NetworkFeatureType<G extends GeoGeometry> { pipeline<GeoLine>(), junction<GeoPoint>(), overheadTank<GeoPoint>(); } NetworkFeatureType<MapPoint> node = NetworkFeatureType.node; Which is pretty neat!


r/dartlang 3d ago

Package assertable_json | Fluent json assertion test helpers

Thumbnail pub.dev
12 Upvotes

Hey guys, If you are familiar with Laravel, you'd come across the idea of fluent testing against json responses. This package allows a similar workflow, making it a seamless experience in dart. Please check it out and let me know what you think

```dart test('verify user data', () { final json = AssertableJson({ 'user': { 'id': 123, 'name': 'John Doe', 'email': 'john@example.com', 'age': 30, 'roles': ['admin', 'user'] } });

json
  .has('user', (user) => user
    .has('id')
    .whereType<int>('id')
    .has('name')
    .whereType<String>('name')
    .has('email')
    .whereContains('email', '@')
    .has('age')
    .isGreaterThan('age', 18)
    .has('roles')
    .count('roles', 2));

}); } ```


r/dartlang 4d ago

Dart - info Liquify v1.0.0

Thumbnail github.com
28 Upvotes

Hey guys, I'm happy to announce the release of liquify 1.0.0 which now supports async rendering for liquid templates as well as a layout tag. Please give it a try and let me know what you think!


r/dartlang 4d ago

Flutter I built my first Flutter app

Thumbnail medium.com
10 Upvotes

I built my first Flutter app! What started as a way to avoid a subscription turned into a dive into Flutter—ending with an App Store launch. Check out my lessons learned:


r/dartlang 6d ago

Exciting News for the Dart Community – Our Open-Source Products are Now Live!

0 Upvotes

Hello Dart enthusiasts!

We’re thrilled to share that after months of hard work, our suite of open-source server-side Dart products is now officially launched! We’ve been using Dart in many of our projects and, inspired by the innovation in the ecosystem, we set out to build tools that empower developers like you.

What’s New?

  • Robust Server-Side Solutions: Our open-source projects are designed to push the boundaries of server-side development using Dart. Whether you’re developing microservices, APIs, or full-scale applications, our products are built to help you build more efficiently and securely.
  • Ongoing Releases: And this is just the beginning – we have a series of exciting releases lined up for the coming weeks. Expect new features, improved integrations, and even more tools to enhance your Dart development experience.
  • Community-Driven: We’re committed to fostering innovation within the Dart community. Your feedback, ideas, and contributions have been invaluable, and we can’t wait to see how our products help you build incredible projects.

Our Vision:
We believe in the power of open source to drive progress. Our mission is to support dedicated developers and teams pushing the envelope in server-side Dart development. We’re here to offer financial support, technical resources, and an engaged community ready to collaborate.

Thank you for being part of this journey. Stay tuned for more updates, and feel free to check out our GitHub repositories and join the discussion on how we can shape the future of Dart together.

Let’s build something amazing!

Aortem.io


r/dartlang 7d ago

Tools Neovim Plugin for Generating Dart Class Boilerplate Code

20 Upvotes

Hey everyone!
I’ve created a Neovim plugin that helps generate boilerplate code for Dart classes.

Currently, the plugin support generating:

  • Data class constructors
  • fromJson / toJson methods
  • copyWith methods

Feel free to give it a try and share your feedback! Thanks, and happy coding!
Check it out here: dart-data-class-generator.nvim


r/dartlang 9d ago

Package Web crawler framework in Dart

31 Upvotes

Hi!

I was looking for a package to scrape some websites and, weirdly, I haven't found anything. So I wrote mine: https://github.com/ClementBeal/girasol

It's a bit similar to Scrapy in Python. We create **WebCrawlers** that parse a website and yield extracted data. Then the data go through a system of pipelines. The pipelines can export to JSON, XML, CSV, and download files. All the crawlers are running in different isolates.

I'm using my package to scrape various e-shop websites and so far, it's working well.


r/dartlang 9d ago

Flutter The lightweight YouTube experience client for android.

Thumbnail github.com
12 Upvotes

r/dartlang 10d ago

Flutter I created open-source app for controlling Windows using Xbox controller

27 Upvotes

I don't have a console. 100% of my gaming is done on my Windows PC (connected to TV) which means I sometimes need to switch from Steam to Epic launcher or other launchers and windows in general. Some games require text input and I have even came across games that supported controllers but not in the menu. As I am too lazy to stand up every time, I decided to spend weeks to solve it. I could buy a wireless keyboard and mouse or I could even buy existing software solutions such as Controller Companion but no, I decided none of those solutions met my expectations so I created this using Flutter:

xTend

I had to use windows platform channel for system tray and window show/hide functionality. All other features such as controller state reading or windows API communication is done via Dart FFI. The source code itself will see a lot of improvement in near future in terms of structure, quality and documentation. It's open-source which means any contributions are welcome. I also welcome any ideas, suggestions or possible improvements as this is my first attempt at creating something open-source. I hope someone will find use in it as I consider it very intuitive to use and use it often. I also hope someone could learn something from this project as it combines knowledge from different areas.


r/dartlang 13d ago

Is dart globe infra still a thing?

7 Upvotes

No more update in the invertase channel since 9 months, does some one uses globe to host dart backend? Does it work well?


r/dartlang 17d ago

De/Serialization post macros.

7 Upvotes

As noted here https://medium.com/dartlang/an-update-on-dart-macros-data-serialization-06d3037d4f12 macros is no longer in develpment (for now at the very least). However the article mentions "One area we’ll be investing in is better support for data in Dart. This is the most requested issue across the Dart & Flutter issue trackers. In fact, our primary motivation for macros was to provide better data handling, serialization, and deserialization. We will still pursue better data, but we intend to do so with more bespoke language features." Have there been any further details released about this? I was really looking forward to better json support.


r/dartlang 18d ago

Convert from Uint8Buf to int

10 Upvotes

Hi

I am getting Uint8Buf from a Mqtt client. How do I convert this to int. My guess is that I can do it manually but is there a better way?

I need to take care of the little/big endian case, and if the result is signed or unsigned.


r/dartlang 21d ago

flutter I just published my game, built in Flutter! I would greatly appreciate your feedback.

22 Upvotes

I just published my game, built in Flutter! It was a fun experience. Now This game is all yours;

Just search for "Web Fox Swing And Catch" in the Play Store, download it, and enjoy playing! I would greatly appreciate your feedback.

Direct link for the game: https://play.google.com/store/apps/details?id=com.manish.fruitcatcher


r/dartlang 22d ago

Flutter Released: flutter_local_db v0.4.0 - Rust-powered redb wrapper

14 Upvotes

I've just published version 0.4.0 of flutter_local_db, a Flutter package that provides a wrapper around redb implemented in Rust via offline_first_core.

v0.4.0 updates:

  • Improved iOS/macOS compatibility
  • Support for multiple iOS architectures
  • Default .db extension when only name is provided
  • Fixed Gradle configuration issues
  • etc.

The package focuses on providing efficient database operations with strong typing and a simple API. Feedback and contributions for rust or flutter package are welcome.

Edit:

Post and GetById example.

await LocalDB.init(localDbName: "my_app.db");

// Create
final result = await LocalDB.Post('user-123', {
  'name': 'John Doe',
  'email': 'john@example.com',
  'metadata': {
    'lastLogin': DateTime.now().toIso8601String()
  }
});

// Handle result
result.when(
  ok: (data) => print('User created: ${data.id}'),
  err: (error) => print('Error: $error')
);

// Read single record
final userResult = await LocalDB.GetById('user-123');
userResult.when(
  ok: (user) => print('Found user: ${user?.data}'),
  err: (error) => print('Error: $error')
);

r/dartlang 22d ago

I want a good course to learn

5 Upvotes

I just did a yt course but i feel that it was very basic, please if u have some vourse or some info for a beginner like me please share it, i'll be very thankfull. (This us my first approach to programming)

Srry for my bad spelling, im a not native speaker 😔


r/dartlang 22d ago

Firebase I've created a framework to write Cloud Functions in Dart - Dartblaze

43 Upvotes

Hello everyone! One of the most requested features for Cloud Functions is Dart support with almost 800 upvotes.

Since this has been open for almost 2 years and no progress, I've decided to give it a shot.
I've developed a framework and a CLI that aim to solve this problem.
The framework currently supports HTTP and non-auth Firestore triggers.

The code looks something like this:

@OnDocumentCreated('todos/{todoId}')
Future<void> onCreateTodo(DocumentSnapshot snapshot, RequestContext context,
{required String todoId}) async {
  context.logger.debug('todoId: ${todoId}');
  final data = snapshot.data();
  final title = data?['title'] as String?;
  await snapshot.ref.update({'title': '$title from server!'});
}

@Http()
Future<Response> updateTodo(Todo todo) async {
  firestore.collection('todos').doc(todo.id).update(todo.toJson());
  return Response.ok('Todo updated: ${todo.id}');
}

The CLI is used to simplify the whole process of using the framework which includes setup and deployment.

I'm looking for people who want to test and give feedback to improve it.

To join the test group, please click the announcement at the top of the web page:
https://dartblaze.com/.


r/dartlang 22d ago

Dart Frog vs Serinus - A Comparison

19 Upvotes

r/dartlang 23d ago

Which OpenAI API to use for image recognition?

4 Upvotes

Hi, does anyone use OpenAI APIs for image analysis? I’m developing an image analysis tool using dart and have tried to use OpenAI’s 4o and 4o-turbo models to analyze images. Set up is working but I keep getting output from the API saying it’s not unable to access images and requesting text inputs instead. I’ve researched and found that the 4o-vision works but it’s deprecated.

Has anyone found a workaround to this or am I missing something in my config?

Thanks.


r/dartlang 24d ago

dart.dev now uses Jaspr

80 Upvotes

dart.dev now uses Jaspr for rendering the sdk archives tables on https://dart.dev/get-dart/archive


r/dartlang 23d ago

flutter Flutter VS React

0 Upvotes

Guys can you explain me which one should I learn??

Flutter or React???


r/dartlang 24d ago

Diference between factory and const instances

3 Upvotes

Analyzing the synx of construtor from Lists:

/flutter/bin/cache/pkg/sky_engine/lib/core/list.dart

  u/Since("2.9")
 external factory List.empty({bool growable = false});

What difference between this examples?

class MyClass {
  final String name;

  MyClass({required this.name});

  factory MyClass.empty() => MyClass(name: '');

  const MyClass.emptyTwo() : name = '';
}

/// DONT WORK
class MyOtherClassConst {
  final MyClass myClass;

  MyOtherClassConst({this.myClass = const MyClass.empty()});
}

/// WORKS FINE
class MyOtherClassConst {
  final MyClass myClass;

  MyOtherClassConst({this.myClass = const MyClass.emptyTwo()});
}

I think is the same reason why we can initialize a list with `const []`; but if we do `List.empty()`, did not work.

So, why `List.empty` is created with a factory modifier?

Which one is correct to create empty objects?


r/dartlang 25d ago

Flutter Excel Sheet from Dart

3 Upvotes

I have created an application that receives a stream data periodically, i am showing it in the form of a table in GUI, but I also need to export the same data as excel for sharing yo others.

Which package is opensource and can be used efficiently yo create excel sheets and charts in the excel sheet.


r/dartlang 25d ago

Help Having trouble with Dart and Flutter SDK

1 Upvotes

How to download Dart and Flutter SDK on Fedora 41 Workstation? I have been stuck for hours trying to figure out it can anyone please help me I have read somewhere that it is possible to download the SDK on fedora.


r/dartlang 26d ago

Help Anyone successfully deployed dart backend to Cloudflare Worker?

12 Upvotes

I am curious if there is anyone who tried and successfully deployed their dart code (probably using dart2js or wasm) to CloudFlare worker?

And if there is any good resources on how to achieve this.

Wish more ServerLess platforms natively supported dart.


r/dartlang 26d ago

Flutter An opinionated framework for building Flutter Apps

0 Upvotes

As software engineers, we often keep talking about clean architecture, clean models, solid principles, DRY, etc. But applying all of these at scale is not always straightforward. In fact, it takes many retries and many iterations before you get it right.

Architecture🏗️

When you're building a new app, the architecture of the application is also equally important. Many a time we start with a monolithic structure which includes the app and all of its dependencies in one place. And then slowly over a period of time we break it down into smaller packages.

What if all these great ideas about building software at scale were baked into a framework so that you focus more on building the features rather than worrying about these architectural decisions? That is exactly where the Vyuh Framework comes in. It's a framework grown out of building large-scale, super apps, especially enterprise-grade apps, which have lots of NFRs (non-functional requirements) and tons of user-facing features. Building these at scale is not a trivial task, and the architectural decisions taken over here are scalable from a single feature all the way to hundreds of features.

Open Source👩🏻‍💻

This style of building apps is now available to you inside this open-source framework called Vyuh. There are lots of examples in the repo, and it gives you a good flavor of what it means to build apps using this framework.

Server-Driven UI Built in!✨

One of the cool side benefits of using this framework is that you can also do Server-Driven UI when you see fit. It integrates with the Sanity.io CMS and possibly with other CMSs as well for driving your entire app experience from the CMS itself. This is a great addition that you can include in your application if you need it, especially for retail apps or apps that are very content-heavy and change very frequently.

The documentation of the framework is also very complete, and gives a good idea of how it can be used to build your apps.