r/dartlang • • Jun 02 '22

Introducing Jaspr - A complete web-framework written in Dart

194 Upvotes

Hi fellow developers,

I'm really excited to finally share with you what I've been working on over the last few months:

Jaspr is a complete web-framework that is written in Dart. It takes inspiration from frameworks like React or Remix, but most importantly Flutter. While it renders normal HTML & CSS, it looks and feels very much like Flutter. So while you get all the benefits of an actual web app (fast page load, seo, server-side rendering, etc.) you get the familiar structure of stateless, stateful and inherited widgets.

There is so much to talk about, but here are some highlights:

1. Familiar component model similar to Flutter widgets but adapted for the web

It was made to look and feel just like Flutter, while rendering normal HTML and CSS. It is therefore targeted mainly at Flutter developers that want to build websites but don't want to use Flutter Web (for various good reasons).

With Dart as its language, it also has some general advantages over JS (in my opinion) like type- and null-safety.

2. Server-side rendering out of the box!

A simple jaspr serve and you will have a running debug server with ssr and automatic reloads. You can still do SPAs but it's not that satisfying.

(And I'm also planning to support static site generation in the future)

3. Good documentation is vital

So I made sure everything is well documented right from the start. Check out the wiki.

4. Online Playground inspired by DartPad

I love DartPad, but it only supports selected packages, so I made my own version. It's called JasprPad and you can check it out here.

Like DartPad you can write and execute jaspr apps right in your browser. It also comes with a range of examples that you can check out, and I even made a tutorial to get you started.

As a bonus, JasprPad is not only for writing jaspr apps, but is written with jaspr itself, so it doubles as a real-world showcase.

5. Riverpod for Jaspr

State-Management will be the same for jaspr as it is for Flutter thanks to the shared widget structure. So I added jaspr_riverpod, porting over flutter_riverpod to jaspr.

6. Testing

Yes, I even made a testing package for 'jaspr', out of the need to test the framework itself. Jaspr is already well test atm. with a coverage of around 70%, but I'm planning to improve this even more in the future.

The package itself jaspr_test takes inspiration from flutter_test but has some unique concepts because jaspr apps need to be both tested for the server and client.

======================================================

This is just the initial release, so expect more awesome stuff coming soon. I'm very eager to get feedback on this since it was quite some while in the making.

Here again the most important links:


r/dartlang • • Sep 05 '22

flutter My only issue with Dart/Flutter

Post image
169 Upvotes

r/dartlang • • Apr 12 '21

I made my first Todo List App in Dart!

Thumbnail
imgur.com
149 Upvotes

r/dartlang • • Mar 30 '23

Tools I’m working on a prototype for a tool that visualizes intra-project dependencies between the source files of a Dart project.

114 Upvotes

r/dartlang • • May 28 '20

Dart is now #7 on the most loved and now moved ahead if Swift and C#

114 Upvotes

r/dartlang • • May 25 '22

Dart Language Developed a free utility that extracts text from code screenshots in seconds, using Dart- https://www.codefromscreenshot.com

103 Upvotes

r/dartlang • • Apr 19 '21

Package Aqueduct is dead, Long live Conduit

103 Upvotes

You may have heard that the Dart REST server, Aqueduct, has been discontinued.

I'm now rather pleased to announce that a new community has formed around the ashes of Aqueduct to create the Conduit project.

Starting with the existing Aqueduct code base, the Conduit team has renamed the project and have now completed Conduit's migration to nnbd and released a beta version of the code.

Except for naming conventions and nnbd changes, Conduit is fully compatible with Aqueduct.

Once we have sufficient feedback from the beta we will move forward with a release; hopefully in the next few weeks.

I'm a true believer in Dart's future, with server side Dart development being the next big step forward.

The Flutter/Conduit pair makes doing full stack development using a single language not only viable but optimal. Add DCli* to automate your production environment and you have a single language to rule your entire devops platform.

I look forward to working with the community to make that a reality.

If you are interested in getting involved or just want to take Conduit out for a spin then here are a few resources that you may find useful.

Online manual: https://gitbook.theconduit.dev/

Discord Invite: https://discord.gg/ASK6vxr88f

Github repo: https://github.com/conduit-dart/conduit

Migration guide (aqueduct to conduit): https://gitbook.theconduit.dev/migration_guide

Pub.dev: https://pub.dev/packages/conduit/versions/2.0.0-b1

Note: to get the beta you MUST use:

dart pub global activate conduit 2.0.0-b1

Regards,

Brett Sutton

Noojee IT.

* apologies, DCli is my passion project so I just have to mention it.

https://pub.dev/packages/dcli


r/dartlang • • Jun 10 '20

Announcing sound null safety

103 Upvotes

From the announcement:

Today is a major milestone for the Dart team with the tech preview of our null safety work. Null safety helps you avoid a class of bugs that are often hard to spot, and as an added bonus enables a range of performance improvements. We’re now releasing an early tech preview, and we’re looking forward to your feedback.

Once you read the announcement, check out the documentation and a null-safe enabled DartPad.


r/dartlang • • Aug 12 '26

Dart Language Announcing Dart 3.13

Thumbnail
dart.dev
102 Upvotes

r/dartlang • • Feb 17 '22

Package Zap: A new reactive Dart web framework

Thumbnail simonbinder.eu
95 Upvotes

r/dartlang • • Aug 23 '20

90 new AWS services available as Dart packages

95 Upvotes

We've now released 90 more AWS service APIs for a total of 217 packages, covering almost all available services AWS has to offer.

A known missing service is EC2, since the EC2 has a separate service protocol from all the others. PRs welcome!

Cheers


r/dartlang • • Aug 19 '24

flutter Dart is not only flutter.

94 Upvotes

I was creating a landing page for my App developed in Flutter that I will launch in the next few days and for this I decided to use Hugo + Boostrap. So, when I wanted to install SASS, I recently found out that the core is developed with Dart. I'm glad to see that Dart is growing outside of the Flutter ecosystem. It was nice to see the source code and feel at home. I was afraid to see a lot of javascript code but that wasn't the case, congratulations to the sass team.


r/dartlang • • Dec 08 '21

Announcing Dart 2.15

Thumbnail
medium.com
93 Upvotes

r/dartlang • • Mar 03 '21

Announcing Dart 2.12

Thumbnail
medium.com
93 Upvotes

r/dartlang • • Sep 11 '21

Dart - info [SERIOUS] Future() vs Future.value() vs Future.sync() vs Future.microtask()

92 Upvotes

Hello, everyone!

I recently spent more than 2 days trying to figure out the difference between all Future named constructors. I'll omit .delayed as it's pretty much the same as a normal Future with a delay in execution.

  • Future()

  • Future.value()

  • Future.sync()

  • Future.microtask()

I have created this example:

import 'dart:async';

void main(List<String> arguments) {
  print('Start');

  Future(() => 1).then(print);
  Future(() => Future(() => 2)).then(print);

  Future.value(3).then(print);
  Future.value(Future(() => 4)).then(print);

  Future.sync(() => 5).then(print);
  Future.sync(() => Future(() => 6)).then(print);

  Future.microtask(() => 7).then(print);
  Future.microtask(() => Future(() => 8)).then(print);

  Future(() => 9).then(print);
  Future(() => Future(() => 10)).then(print);

  print('End');
}

The output for it is

Start                                                
End
3                                                      
5  
7  
1  
4  
6  
9  
8  
2  
10 

Now, if you were like me, and you didn't understand for 2 days straight why was this output generated, I think I finally understood why, and I will explain the though process I've been going through. Hopefully, somebody from this subreddit will be able to confirm on whether I'm correct or not. Therefore, here we go with the explanation.

At the beginning I like to think that there's an event list containing all lines of code the isolate scanned from my main.dart file. Therefore, this list will look something like this:

print('End'); 
Future(() => Future(() => 10)).then(print); 
Future(() => 9).then(print);
Future.microtask(() => Future(() => 8)).then(print); 
Future.microtask(() => 7).then(print); 
Future.sync(() => Future(() => 6)).then(print); 
Future.sync(() => 5).then(print); 
Future.value(Future(() => 4)).then(print); 
Future.value(3).then(print); 
Future(() => Future(() => 2)).then(print); 
Future(() => 1).then(print); 
print('Start');

Imagine that the scanner is at the end, ready to scan the first element, which is Start. More like a FIFO structure. Now, the isolate will assign each of these lines of code to either the EVENT QUEUE or the MICROTASK QUEUE.

This task has been probably the hardest for me to understand.

So, currently the EVENT QUEUE, MICROTASK QUEUE and output sequence are all empty.

EVENT QUEUE:
MICROTASK QUEUE:
PRINT:

So, we'll process the first line, which is print('Start'), a synchronous task that we can execute right away, therefore the trio looks like this.

EVENT QUEUE:
MICROTASK QUEUE:
PRINT: Start

Then, we move over to the next line, which is Future(() => 1).then(print);

Now, from what I understood, this Future is going to complete with a value of () => 1, therefore it is actually going to put the () => 1 into the event queue. As a result, the trio will look like this after this step.

EVENT QUEUE: () => 1
MICROTASK QUEUE:
PRINT: Start

Moving on, the next line is *Future(() => Future(() => 2)).then(print);*Similar to the previous step, this time we're going to put () => Future(() => 2)) to the event queue.For simplicity I'll rename () => 1 to 1 and () => Future(() => 2)) to F(2).

Now, the trio is going to look like this:

EVENT QUEUE:  F(2), 1
MICROTASK QUEUE:
PRINT: Start

Now, onto the next one, we have *Future.value(3).then(print);*From what I understood, and what I saw from the docs:

  • Future.value(x)

    • x is not future => x will be set as a new microtask event into the microtask queue

    • x is Future => x will be set as a new event into the event queue ( since Future.value(x) = Future (() => x) in this case, and it's like processing F(x) at the current step, therefore, we'll end up in placing x on the event queue)

As a result, in my case, I would set 3 (actually print(3)) as a microtask event, therefore the new trio looks like this:

EVENT QUEUE:  F(2), 1
MICROTASK QUEUE: 3
PRINT: Start

Now, for the next line Future.value(Future(() => 4)).then(print); the argument sent to the Future.value() constructor is actually another future, so it falls back to the first option above. As a result, we'll set 4 as a new event into the event queue. This is because Future.value(Future(() => 4) is treated like Future(() => 4) by the event loop, therefore 4 will come later on the event queue. The trio looks like this right now.

EVENT QUEUE:  4, F(2), 1
MICROTASK QUEUE: 3
PRINT: Start

Moving on, we have the Future.sync(() => 5).then(print); line of code. From the docs, I actually read that:

x is non-future => Future.value(x) => Future.sync(() => x), and as a result of this, we'll place 5 as a new microtask event on the microtask queue. Therefore, the trio will look like this now.

EVENT QUEUE:  4, F(2), 1
MICROTASK QUEUE: 5, 3
PRINT: Start

Onto the next line, Future.sync(() => Future(() => 6)).then(print); , from the docs I saw that in this case,

x is Future => Future.sync(() => x) is equal to Future(() => x). As a result, we'll treat it just like a normal Future, and place it's complete value that's going to come on later on the event queue. The trio looks like this right now:

EVENT QUEUE: 6, 4, F(2), 1
MICROTASK QUEUE: 5, 3
PRINT: Start

The next line is Future.microtask(() => 7).then(print); From the docs I understood that this uses the scheduleMicrotask() function to place 7 on the microtask queue. As a result, the trio will result in this:

EVENT QUEUE: 6, 4, F(2), 1
MICROTASK QUEUE: 7, 5, 3
PRINT: Start

However, the big surprise comes for the next line: *Future.microtask(() => Future(() => 8)).then(print);*In this case, even though the parameter is a Future, it's still used in a scheduleMicrotask() function, therefore the F(8) will be placed on the Microtask Queue this time, and the trio will look like this.

EVENT QUEUE: 6, 4, F(2), 1
MICROTASK QUEUE: F(8), 7, 5, 3
PRINT: Start

The next two lines

Future(() => Future(() => 10)).then(print);

Future(() => 9).then(print);

are directly places as new events into the event queue, are they're normal futures. The trio will therefore look like this:

EVENT QUEUE: F(10), 9, 6, 4, F(2), 1
MICROTASK QUEUE: F(8), 7, 5, 3
PRINT: Start

And we arrive to process the final line, which can be tackled in a sync manner, therefore we will print End, the trio after we process every line of code looks like this.

EVENT QUEUE: F(10), 9, 6, 4, F(2), 1
MICROTASK QUEUE: F(8), 7, 5, 3
PRINT: Start End

Now, as I learned, Dart is a single thread language, therefore, the event loop can't accept both of these queues simultaneously. The microtask queue has priority. Therefore, we'll start by processing the microtask events.

We'll go with 3, 5, 7 and print them.Then, we'll take event F(8) which is a Future. As a result, we'll place 8 at the end of the event queue, since that's where all normal Futures are enqueued. The trio will, therefore look like this now:

EVENT QUEUE: 8, F(10), 9, 6, 4, F(2), 1
MICROTASK QUEUE: 
PRINT: Start End 3 5 7 

The microtask queue is empty now, so the event loop can move over to processing the events from the event queue.

As a result, it processes 1, which prints 1.Then it moves to F(2) which is going to add 2 at the end of the event queueThen it moves to 4 which is going to print 4Then it moves to 6 which is going to print 6Then it moves to 9 which is going to print 9Then it moves to F(10) which is going to add 10 at the end of the event queueThen it moves to 8 which is going to print 8

As a result the trio looks like this right now:

EVENT QUEUE: 10 2
MICROTASK QUEUE: 
PRINT: Start End 3 5 7 1 4 6 9 8 

In the end, there are only two events left on the event queue, and the event loop processes them one at a time, printing their values. This is why at the end, the trio with the output looks like this:

EVENT QUEUE: 
MICROTASK QUEUE: 
PRINT: Start End 3 5 7 1 4 6 9 8 2 10

I would really appreciate any feedback on how I tackled this entire problem as I spent too much time on it. I want to know if I'm correct in how I set up the queues and solved the problem.Thank you!


r/dartlang • • Dec 15 '20

Dart Language A first draft of Dart's future pattern matching syntax

Thumbnail
github.com
89 Upvotes

r/dartlang • • Feb 12 '25

Announcing Dart 3.7

Thumbnail
medium.com
88 Upvotes

r/dartlang • • Sep 08 '21

Announcing Dart 2.14

Thumbnail
medium.com
88 Upvotes

r/dartlang • • Aug 07 '20

Call of Duty(1) cheats in Dart

88 Upvotes

r/dartlang • • Jul 02 '24

Package rust_core v1.0.0 Released 🎉

87 Upvotes

Happy to announce that today we released rust_core v1.0.0!

rust_core is an implementation of Rust's core library in Dart. To accomplish this, Rust's functionalities are carefully adapted to Dart's paradigms, focusing on a smooth idiomatic language-compatible integration. The result is developers now have access to powerful tools previously only available to Rust developers and can seamlessly switch between the two languages.

In support of this release, we are also releasing the Rust Core Book 📖 to help you get familiar with the concepts. Enjoy!


r/dartlang • • Oct 26 '24

Godot Dart Updates

85 Upvotes

Hi everyone!

I'm back to talk about the ability to use Dart in Godot! For those that don't know, I've been working (on and off) on a GDExtension that adds Dart as a scripting language for the Godot game engine, the source of which lives on github. Recently, in conjunction with releases for dart_shared_library I've been able to setup Github actions to automatically build a packaged extension which should now be generally usable, though with a lot of rough edges.

Here are steps to get started for anyone that wants to try it out:

  • Download the latest passing build from Github Actions

  • Create a Godot project

  • Unzip the extension into your project directory.

  • Run dart pub get from the "src" directory

  • Run dart run build_runner build (or alternately build_runner watch if you're going to start working immediately)

  • Reopen your Godot project.

When attaching scripts, you should now be able to create Dart scripts instead. More information about usage is available in the README in the repo.

I'm attempting to make some of the setup easier, allowing Godot to set up the project and run pub get but I'm not sure how stable that is.

In terms of functionality, I've started attempting to use the extension to make something more real, and it's worked pretty well so far. While I'm not anywhere near it being a first class, production level language for Godot, it's certainly usable.

If you run into issues, feel free to post them on the issues. I'm also open to contributions and I'll try to document issues that I know about that might be good first issues.


r/dartlang • • Feb 16 '23

Flutter After 2 months of learning flutter, i finished my first app using Firebase and Bloc.

85 Upvotes

r/dartlang • • Feb 25 '25

dart.dev now uses Jaspr

82 Upvotes

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


r/dartlang • • Mar 30 '23

Tools Hey folks! I am currently working on an open source API client built using Flutter that can be used create API requests, visually inspect responses, and also generate Dart code for API requests. Appreciate any feedback! GitHub - https://github.com/foss42/api-dash

81 Upvotes