This is a test message to test the length of the message box.

Flutter - Develop own packages (Part 2)


In the continuation of the series, we deal with the testing and further development of our own darts package from the last article.

In the first part, we mainly dealt with the implementation and use of the package. However, it is less clear how to actually develop the package further. That is why we want to refer to the topic of testing and further development today. If you haven't read the first part of the article, we recommend that you do so, so that you know what it's about.



When developing packages, it is considered best practice to also create an example for the other developers. This example is in the package in the example directory and represents a working prototype.

In the first step, we can run the built-in command "flutter create example" in our project, so that a new flutter app is created directly in our package. With this method, certain files are also not created, which we do not need in this example (CHANGELOG or LICENECE).


In the example directory you will find your usual structures and the file main.dart, in which you can do your example implementation. But before you can start with the implementation, you have to register your package via the pubspec.yaml file.


By specifying the path, we do not have to download the package first, but refer directly to the main package. So we only need some code in the main.dart.

import 'package:flutter/material.dart';
import 'package:testflutterpackage/pages/LoginPage.dart';

void main() {

class TestApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Test App',
    home: LoginPage(),



Normally you have to expand the configuration, otherwise you cannot start the sample app. To do this, create a new entry with the "+" symbol via the menu under "Run -> Edit Configurations ...". Choose Flutter, because we want to start a Flutter application. We assign main.dart as the name and store the path to the file, which serves as the entry point for the application for Dart.


Now you can start your device as usual and start with the main.dart for the test and expand the code. The hot reload works in the sample project, but also in the overall package that we are currently developing. One of the strengths of Flutter can be used as usual.



If you have components that need to be issued and you are developing the package further, it is definitely recommended to create an example. However, since this procedure is also common practice, you should also do it for other developers who may also use your package.

Included topics:
FlutterPrivate packagesOwn packagesGitTest
Comments (0)

And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.

Flutter - Finance Overview (Framework)

Category - Flutter

Before we actually start developing the app, we will first work on the second version of the SwH framework in order to create a reusable basis.


Flutter - Finance Overview (Data)

Category - Flutter

Today we are talking about the data model of the app in the first preview, the design of the API and the challenges involved.


Flutter - Finance Overview (Project)

Category - Flutter

We start a new project and take you through the various stages from planning to development to release. In this article the explanation of what stands behind the project.


Flutter - #FlutterEngage

Category - Flutter

The FlutterEngage event is over and there was again a lot of helpful and interesting information for all Flutter developers among us. We want to briefly summarize the most important points here.


Flutter - Learning source

Category - Flutter

In this article we want to introduce you to some current learning sources that you can use as inspiration and for further education. Here we will mainly deal with YouTube channels and present some.