Skip to content

A most easily usable RESAS API wrapper in Dart. With this library, you can easily integrate your application with the RESAS API.

License

Notifications You must be signed in to change notification settings

myConsciousness/resas

Repository files navigation

logo

A most easily usable RESAS API wrapper library in Dart!

pub package

1. About

Resas is an open-sourced Dart library.
With this library, you can easily integrate your application with the RESAS API.

Resas is an unofficial library.

1.1. What Is RESAS?

It is a system that aggregates and visualizes public and private sector big data on industrial structure, demographics, and human flows in Japan.

The Regional Economic Analysis System (RESAS) is provided by the Ministry of Economy, Trade and Industry (METI) and the Cabinet Secretariat (Secretariat of the Headquarters for the Creation of New Town, New Human Resources and New Work) to support various initiatives for regional development from an information perspective.

It is widely used by local government officials and people from various fields who are interested in regional revitalization to plan, implement, and verify effective measures.

1.2. Introduction

1.2.1. Install Library

With Dart:

 dart pub add resas

With Flutter:

 flutter pub add resas

1.2.2. Import It

import 'package:resas/resas.dart';

1.2.3. Use Resas

In order to use the RESAS API, you need an API key issued on the official website. Generate the API key from the following site and pass it to the constructor of the Resas class.

import 'package:resas/resas.dart';

void main() async {
  final resas = Resas.connectWith(
    key: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // ← Replace with your API key.
  );

  // Once the instance is created, you can easily access the API by simply calling the method.
  final prefecturesResponse = await resas.common.prefectures();

  // It's easy to handle response status.
  if (prefecturesResponse.status.isNotOk) {
    // Do something when status is not OK (200).
    return;
  }

  print(prefecturesResponse);

  final citiesResponse = await resas.common.cities(
    prefectureCode: prefecturesResponse.result![0].code,
  );
  print(citiesResponse);

  final oldCitiesResponse = await resas.common.oldCities(
    prefectureCode: prefecturesResponse.result![0].code,
    cityCode: citiesResponse.result![0].code,
  );
  print(oldCitiesResponse);
}

1.3. License

Copyright (c) 2021, Kato Shinya. All rights reserved.
Use of this source code is governed by a
BSD-style license that can be found in the LICENSE file.

1.4. More Information

Resas was designed and implemented by Kato Shinya.

About

A most easily usable RESAS API wrapper in Dart. With this library, you can easily integrate your application with the RESAS API.

Topics

Resources

License

Stars

Watchers

Forks

Languages